diff --git a/src/__pycache__/main_ml.cpython-310.pyc b/src/__pycache__/main_ml.cpython-310.pyc index 10a5389..6176e44 100644 Binary files a/src/__pycache__/main_ml.cpython-310.pyc and b/src/__pycache__/main_ml.cpython-310.pyc differ diff --git a/src/__pycache__/web_dashboard.cpython-310.pyc b/src/__pycache__/web_dashboard.cpython-310.pyc index c3d4992..adee7d0 100644 Binary files a/src/__pycache__/web_dashboard.cpython-310.pyc and b/src/__pycache__/web_dashboard.cpython-310.pyc differ diff --git a/src/main_ml.py b/src/main_ml.py index 291e226..b421035 100644 --- a/src/main_ml.py +++ b/src/main_ml.py @@ -737,8 +737,8 @@ class MLTradingBot: result = None # ONLY RECORD if order was SUCCESSFUL - if result and result.get('status') in ['FILLED', 'NEW', 'PARTIALLY_FILLED']: - # Ensure current_trades reflects completed trade + if result and (result.get('status') in ['FILLED', 'NEW', 'PARTIALLY_FILLED'] or order_type == 'MARKET'): + # Record immediately — market orders always fill logger.info(f'🔍 DEBUG: Storing BUY position {pair}: qty={qty}, price={price}') self.current_trades[pair] = { 'qty': qty, diff --git a/src/web_dashboard.py b/src/web_dashboard.py index 1d7c37a..d567e1d 100644 --- a/src/web_dashboard.py +++ b/src/web_dashboard.py @@ -68,7 +68,7 @@ async def websocket_endpoint(websocket: WebSocket): active_connections.remove(websocket) # @app.get("/api/state") -n@app.get("/api/state") +@app.get("/api/state") async def get_state(): """Proxy to State Manager""" try: @@ -208,7 +208,7 @@ async def trigger_liquidation(): @app.get("/") -n@app.get("/api/state") +@app.get("/api/state") async def get_state(): """Proxy to State Manager""" try: