Deduct open position margin from recommend max lots.
Recalculate tradable symbol budgets from remaining margin after CTP usage and refresh the table on position updates. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1578,6 +1578,12 @@ def install_trading(app, *, login_required, require_nav, get_db, get_setting, se
|
||||
try:
|
||||
payload = _refresh_trading_live_snapshot(fast=fast)
|
||||
position_hub.broadcast("positions", payload)
|
||||
conn = get_db()
|
||||
try:
|
||||
rec = _recommend_payload(conn)
|
||||
recommend_hub.broadcast("recommend", {"ok": True, **rec})
|
||||
finally:
|
||||
conn.close()
|
||||
except Exception as exc:
|
||||
logger.debug("push position snapshot: %s", exc)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user