diff --git a/src/web_dashboard.py b/src/web_dashboard.py index 3ffb9c4..26e764d 100644 --- a/src/web_dashboard.py +++ b/src/web_dashboard.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Trading Bot Dashboard v0.32 - Bug fixes: Holdings spacing, Chart timestamps (Swiss format, hourly)""" +"""Trading Bot Dashboard v0.32 - Add USD values to Holdings display""" from fastapi import FastAPI from fastapi.responses import HTMLResponse from binance.client import Client @@ -74,15 +74,11 @@ async def history(hours: int = 24): for t, p, u in rows: dt = datetime.fromtimestamp(t) - # Format timestamps: hourly for 1-day, Swiss format for longer periods if hours <= 24: - # Round to hour: "10:00", "11:00" ts = dt.strftime('%H:00') else: - # Swiss format: "15.7" or "15.07.26" - using dd.m format ts = dt.strftime('%d.%m.%y') - # Skip duplicate timestamps if ts in seen_ts: continue @@ -257,7 +253,9 @@ async function updatePortfolio() { hh.innerHTML = ''; for (const [asset, info] of Object.entries(data.balance)) { if (asset !== 'USDT' && info.total > 1e-4) { - hh.innerHTML += '
' + asset + '
' + info.total.toFixed(4) + '
'; + const price = data.prices[asset] || 0; + const usdValue = info.total * price; + hh.innerHTML += '
' + asset + '
' + info.total.toFixed(4) + '
≈ $' + usdValue.toFixed(2) + '
'; } } }