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:
dekun
2026-07-01 12:35:47 +08:00
parent 08d55411aa
commit 9cd81a3ea7
17 changed files with 2214 additions and 227 deletions
+12
View File
@@ -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(
"""