diff --git a/main.py b/main.py index ab2dec9..9c00f71 100644 --- a/main.py +++ b/main.py @@ -110,6 +110,9 @@ def run_cycle(): if w.get("type") == "exchange": wallet_balances[w["currency"]] = w.get("balance", 0) + # Load tracked stops early — needed for both stop sync and fill detection + tracked_stops = _load_tracked_stops() + for sym, pos in port.get("positions", {}).items(): if pos.get("amount", 0) <= 0: continue @@ -196,7 +199,6 @@ def run_cycle(): # --- Detect filled stop-loss orders --- sl_filled = [] - tracked_stops = _load_tracked_stops() active_order_ids = {str(o["id"]) for o in active_orders} for sym, sinfo in list(tracked_stops.items()): if str(sinfo.get("order_id")) in active_order_ids: