Fix monitor closed too early on manual close: keep active until CTP flat and revive for roll.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-03 22:20:53 +08:00
parent 75d9c86593
commit 3c7da47bfb
2 changed files with 47 additions and 3 deletions
+1
View File
@@ -797,6 +797,7 @@ def reconcile_monitors_without_position(conn, mode: str, *, grace_sec: int = 120
cancel_monitor_exit_orders(conn, mon, mode=mode)
except Exception as exc:
logger.warning("cancel exit orders monitor=%s: %s", mon.get("id"), exc)
clear_close_pending(ms, md)
conn.execute("UPDATE trade_order_monitors SET status='closed' WHERE id=?", (mon["id"],))
closed += 1
if closed: