From 8b21d29e69de555cf2bc48b05d228dd60fe51259 Mon Sep 17 00:00:00 2001 From: Adriano Dal Pastro Date: Sun, 26 Jul 2026 20:53:57 +0000 Subject: [PATCH] fix(dashboard): taglia del book letta dal conto, non cablata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Il cruscotto dichiarava "cap $300/asset · capitale reale ≈ $600" come testo fisso: sarebbe diventato falso al primo deposito, sulla pagina che si guarda per capire cosa sta girando. Ora legge equity reale + max_notional_per_asset_frac + disaster_sl_pct dalla config. Reso dinamico solo il testo di stato del book LIVE. I $600/$2000 restanti in dashboard.py sono i capitali d'inizio CONGELATI dei libri paper (forward-monitor): quelli devono restare fissi o le serie perdono continuita'. Verificato il percorso di ESECUZIONE: nessuna assunzione cablata sulla taglia da $600 (book.py / shadow.py / book_execute.py). Reso: "capitale reale $596.92 · cap $298/asset · disaster-SL on-book −30%". 391 test verdi. Co-Authored-By: Claude Opus 5 (1M context) --- src/live/dashboard.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/live/dashboard.py b/src/live/dashboard.py index 9b4ff69..ac08c01 100644 --- a/src/live/dashboard.py +++ b/src/live/dashboard.py @@ -251,6 +251,22 @@ def html(): f"TP01 target: {bits}
→ per gli ordini reali: uv run python scripts/live/live_trend.py (host)") else: shadow_html = "non disponibile" + (f" — {sh['error']}" if sh and sh.get('error') else "") + + # Taglia del book LIVE: letta dal conto e dalla config, MAI cablata. Il testo cablato + # "capitale reale ~$600 / cap $300" e' diventato falso al primo deposito (2026-07-26). + try: + import json as _json + from src.live.book import CONFIG as _CFG + _c = _json.loads(_CFG.read_text()) + _eq = (sh or {}).get("real_equity") + _cap_txt = (f"cap ${_eq * float(_c['max_notional_per_asset_frac']):,.0f}/asset" + if _eq and _c.get("max_notional_per_asset_frac") + else f"cap ${float(_c.get('max_notional_per_asset_usd', 300)):,.0f}/asset") + _eq_txt = f"capitale reale ${_eq:,.2f}" if _eq else "capitale reale non leggibile" + live_size_html = (f"{_eq_txt} · {_cap_txt} · disaster-SL on-book " + f"−{float(_c.get('disaster_sl_pct', 0.30))*100:.0f}%") + except Exception: + live_size_html = "taglia non leggibile" trows = "" for t in d.get("trades", []): cls = "g" if t["action"] == "ENTRY" else "r" @@ -306,7 +322,7 @@ th{{color:#8a93a0;font-weight:500}}.y{{display:inline-block;background:#161b22;b
① LIVE — Deribit mainnet (conto reale, sola lettura)
{_alerts_banner(d.get("book_alerts") or {})}
Shadow TP01 (cosa farebbe ORA sul conto reale, nessun ordine inviato):
{shadow_html}
-

Solo TP01 e' armato live (cap $300/asset · disaster-SL on-book −30% · capitale reale ≈ $600). SKH01/XS01/VRP01 = paper/stat-mode. Lo "Shadow" mostra il target reale ma NON invia ordini.

+

Il book LIVE e' TP01+SKH01 nettati ({live_size_html}). XS01/VRP01 = paper/stat-mode. Lo "Shadow" mostra il target reale ma NON invia ordini.

② TRADES ESEGUITI (reali) + frequenza operativa
Frequenza operativa (contata sui dati certificati, non stimata):
{freq_html}