diff --git a/src/web_dashboard.py b/src/web_dashboard.py index b551923..7983678 100644 --- a/src/web_dashboard.py +++ b/src/web_dashboard.py @@ -84,11 +84,16 @@ async def get_state(): pnl_status = "🟢 PROFIT" if pnl_usdt > 0.01 else ("🔴 LOSS" if pnl_usdt < -0.01 else "⚪ BREAK") pnl_color = "accent" if pnl_usdt > 0.01 else ("negative" if pnl_usdt < -0.01 else "neutral") - # Count active positions = locked coins (NOT trades.json) - active_positions = 0 - for asset in ['BTC', 'ETH', 'SOL', 'BNB', 'XRP']: - if asset in balance and balance[asset]['locked'] > 0.00001: - active_positions += 1 + # Count active positions = open orders from Binance API + try: + open_orders = binance.get_open_orders() + active_positions = len(open_orders) + except: + # Fallback to locked coins if API fails + active_positions = 0 + for asset in ['BTC', 'ETH', 'SOL', 'BNB', 'XRP']: + if asset in balance and balance[asset]['locked'] > 0.00001: + active_positions += 1 trades = load_bot_state()