diff --git a/src/__pycache__/main_ml.cpython-310.pyc b/src/__pycache__/main_ml.cpython-310.pyc index 320cf5a..03369a8 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/main_ml.py b/src/main_ml.py index 4db7a0d..79752c6 100644 --- a/src/main_ml.py +++ b/src/main_ml.py @@ -338,6 +338,7 @@ class MLTradingBot: ) if result and result.get('status') in ['FILLED', 'NEW', 'PARTIALLY_FILLED']: + # Ensure current_trades reflects completed trade logger.info(f'✅ BTC LIQUIDATED! Order ID: {result.get("orderId")}, Status: {result.get("status")}') # Wait for balance to update await asyncio.sleep(3) @@ -532,6 +533,7 @@ class MLTradingBot: ) if result and result.get('status') in ['FILLED', 'NEW', 'PARTIALLY_FILLED']: + # Ensure current_trades reflects completed trade # ONLY record if order was actually EXECUTED profit_usd = (current_qty * current_price) - (buy_qty * buy_price) self.daily_pnl += profit_usd @@ -736,6 +738,7 @@ class MLTradingBot: # ONLY RECORD if order was SUCCESSFUL if result and result.get('status') in ['FILLED', 'NEW', 'PARTIALLY_FILLED']: + # Ensure current_trades reflects completed trade logger.info(f'🔍 DEBUG: Storing BUY position {pair}: qty={qty}, price={price}') self.open_positions[pair] = { 'qty': qty, @@ -752,6 +755,7 @@ class MLTradingBot: # BUY Alert disabled — user only wants profit notifications logger.info(f'✅ BUY FILLED & RECORDED! Order ID: {result.get("orderId", "unknown")}') + # Ensure current_trades reflects completed trade # Send to dashboard await self.dashboard.record_buy(pair, qty, price)