Restore stop-loss and take-profit monitors after restart and CTP reconnect.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+10
-2
@@ -614,8 +614,16 @@ def reconcile_monitors_without_position(conn, mode: str, *, grace_sec: int = 120
|
||||
position_keys.add((sym, direction))
|
||||
|
||||
margin_used = ctp_account_margin_used(mode) or 0.0
|
||||
if not position_keys and margin_used > 300:
|
||||
return 0
|
||||
if not position_keys:
|
||||
if margin_used > 100:
|
||||
return 0
|
||||
try:
|
||||
bridge = get_bridge()
|
||||
since_connect = time.time() - float(getattr(bridge, "_last_connect_ok_ts", 0) or 0)
|
||||
if since_connect < 180:
|
||||
return 0
|
||||
except Exception:
|
||||
return 0
|
||||
|
||||
now_ts = time.time()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user