Bugfix: v0.32 - Holdings spacing margin (no green bg), Chart timestamps hourly (10:00, 11:00), Swiss date format (15.7.26)
This commit is contained in:
parent
2647cbc290
commit
659b2708a2
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Trading Bot Dashboard v0.32 - with Collapsible Holdings, USD values, Mobile-optimized"""
|
"""Trading Bot Dashboard v0.32 - Bug fixes: Holdings spacing, Chart timestamps (Swiss format, hourly)"""
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from fastapi.responses import HTMLResponse
|
from fastapi.responses import HTMLResponse
|
||||||
from binance.client import Client
|
from binance.client import Client
|
||||||
|
|
@ -69,9 +69,25 @@ async def history(hours: int = 24):
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
ts_list, pcts, usdts = [], [], []
|
ts_list, pcts, usdts = [], [], []
|
||||||
|
seen_ts = set()
|
||||||
|
|
||||||
for t, p, u in rows:
|
for t, p, u in rows:
|
||||||
dt = datetime.fromtimestamp(t)
|
dt = datetime.fromtimestamp(t)
|
||||||
ts_list.append(dt.strftime('%H:%M' if hours <= 24 else '%m-%d'))
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
seen_ts.add(ts)
|
||||||
|
ts_list.append(ts)
|
||||||
pcts.append(round(p, 2))
|
pcts.append(round(p, 2))
|
||||||
usdts.append(round(u, 2))
|
usdts.append(round(u, 2))
|
||||||
|
|
||||||
|
|
@ -116,7 +132,7 @@ body{font-family:Segoe UI,Arial;background:#1e1e1e;color:#d0d0d0;min-height:100v
|
||||||
.val{font-size:24px;color:#00ff88;font-weight:bold}
|
.val{font-size:24px;color:#00ff88;font-weight:bold}
|
||||||
@media(max-width:768px){.val{font-size:20px}}
|
@media(max-width:768px){.val{font-size:20px}}
|
||||||
.sub{font-size:14px;color:#999}
|
.sub{font-size:14px;color:#999}
|
||||||
.collapse-header{display:flex;justify-content:space-between;align-items:center;padding:15px 20px;background:rgba(0,255,136,.05);border:1px solid rgba(0,255,136,.2);border-radius:10px;cursor:pointer;margin:20px 0 0 0}
|
.collapse-header{display:flex;justify-content:space-between;align-items:center;padding:15px 20px;background:transparent;border:1px solid rgba(0,255,136,.2);border-radius:10px;cursor:pointer;margin:20px 0 15px 0}
|
||||||
@media(max-width:768px){.collapse-header{padding:12px 15px}}
|
@media(max-width:768px){.collapse-header{padding:12px 15px}}
|
||||||
.collapse-header h3{color:#00ff88;font-size:16px;margin:0}
|
.collapse-header h3{color:#00ff88;font-size:16px;margin:0}
|
||||||
@media(max-width:768px){.collapse-header h3{font-size:14px}}
|
@media(max-width:768px){.collapse-header h3{font-size:14px}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue