Isolate CTP in worker process and improve strategy roll UX.
Split vn.py into qihuo-ctp worker with IPC client bridge, keep CTP connected during breaks with cached account fallback, speed up strategy page loads, and allow off-session breakout roll submissions. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -175,6 +175,18 @@ def build_dashboard_payload(
|
||||
margin_used = round(max(0.0, equity - available), 2)
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
from trading_context import _cached_ctp_account
|
||||
|
||||
cached = _cached_ctp_account(mode)
|
||||
balance = float(cached.get("balance") or 0)
|
||||
if balance > 0:
|
||||
equity = balance
|
||||
avail = cached.get("available")
|
||||
if avail is not None:
|
||||
available = round(float(avail), 2)
|
||||
if equity > 0:
|
||||
margin_used = round(max(0.0, equity - available), 2)
|
||||
|
||||
key_rows = conn.execute(
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user