Bot auto-update: src/web_dashboard.py
This commit is contained in:
parent
e7c8f425a2
commit
17b94a904e
|
|
@ -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_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")
|
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)
|
# Count active positions = open orders from Binance API
|
||||||
active_positions = 0
|
try:
|
||||||
for asset in ['BTC', 'ETH', 'SOL', 'BNB', 'XRP']:
|
open_orders = binance.get_open_orders()
|
||||||
if asset in balance and balance[asset]['locked'] > 0.00001:
|
active_positions = len(open_orders)
|
||||||
active_positions += 1
|
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()
|
trades = load_bot_state()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue