Move fleet stats to nav page; backfill funds and loss metrics from curve/status.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-02 12:43:17 +08:00
parent 921e96321f
commit cd46d7748c
5 changed files with 237 additions and 164 deletions
+14
View File
@@ -220,12 +220,26 @@ async def fleet_status(_tok: Annotated[str, Depends(require_fleet_token)]) -> di
return None
return _sf(key, default)
latest_funds = 0.0
try:
from ..sim.funds_wallets import FundsWallets
latest_funds = float(FundsWallets(db).total_usdt_equiv())
except Exception:
try:
from ..sim.ledger import Ledger
latest_funds = float(Ledger(db).snapshot().get("equity") or 0)
except Exception:
latest_funds = 0.0
return {
"ok": True,
"mode": settings.mode,
"env_name": settings.env_name,
"exchange": exchange_name,
"sim": settings.is_sim,
"latest_funds": latest_funds,
"market_connected": bool(snap.connected) if snap else False,
"pair": snap.pair.to_dict() if snap and snap.pair else None,
"index_px": (