Count roll groups as one position slot and protect monitors during roll.
Include active roll groups in deduped position slots; normalize CTP position keys in reconcile; skip closing monitors tied to active roll groups. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -289,6 +289,15 @@ def active_position_slots_from_monitors(conn) -> set[tuple[str, str]]:
|
||||
sym = (r["symbol"] or "").strip()
|
||||
if sym:
|
||||
keys.add(_position_slot_key(sym, r["direction"] or "long"))
|
||||
for r in conn.execute(
|
||||
"""SELECT m.symbol, m.direction
|
||||
FROM roll_groups g
|
||||
JOIN trade_order_monitors m ON m.id = g.order_monitor_id
|
||||
WHERE g.status='active'"""
|
||||
):
|
||||
sym = (r["symbol"] or "").strip()
|
||||
if sym:
|
||||
keys.add(_position_slot_key(sym, r["direction"] or "long"))
|
||||
except Exception:
|
||||
pass
|
||||
return keys
|
||||
|
||||
Reference in New Issue
Block a user