Bot auto-update: src/__pycache__/web_dashboard.cpython-310.pyc,src/web_dashboard.py
This commit is contained in:
parent
6dec4231d0
commit
d6863872c7
Binary file not shown.
|
|
@ -76,6 +76,13 @@ async def get_state():
|
|||
portfolio_value += data['total'] * price
|
||||
|
||||
usdt_free = balance.get('USDT', {}).get('free', 0)
|
||||
|
||||
# P&L CALCULATION
|
||||
initial_capital = 137.79
|
||||
pnl_usdt = portfolio_value - initial_capital
|
||||
pnl_pct = (pnl_usdt / initial_capital * 100) if initial_capital > 0 else 0
|
||||
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
|
||||
|
|
@ -91,6 +98,10 @@ async def get_state():
|
|||
'usdt_free': round(usdt_free, 2),
|
||||
'active_positions': active_positions, # ← NEW: Real count!
|
||||
'current_trades': trades.get('current', {}),
|
||||
'pnl_usdt': round(pnl_usdt, 2),
|
||||
'pnl_pct': round(pnl_pct, 2),
|
||||
'pnl_status': pnl_status,
|
||||
'pnl_color': pnl_color,
|
||||
'completed_trades': trades.get('completed', []),
|
||||
'prices': prices,
|
||||
'timestamp': datetime.now().isoformat()
|
||||
|
|
|
|||
Loading…
Reference in New Issue