Bot auto-update: src/web_dashboard.py

This commit is contained in:
Marc Blatter 2026-07-09 19:55:01 +02:00
parent e7c8f425a2
commit 17b94a904e
1 changed files with 10 additions and 5 deletions

View File

@ -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()