From 24cf3722fad1fdcac4c7efb70887e007825a7b3c Mon Sep 17 00:00:00 2001 From: ramseshk Date: Tue, 4 Aug 2026 08:38:14 +0000 Subject: [PATCH] Fix strategy detail charts showing empty for Live tab Root cause: openDetail() never set equity/trades for live tab because the live node doesn't send per-strategy equity or per-strategy trades. The live WS sends overall equity_history[] and trades[] array. Changes: - Live tab: uses overall equity_history for chart, filters trades[] by strategy name - Paper tab: uses per-strategy strategy_equity[name] - Chart data: handles both array (live) and dict (paper) equity formats - Backtest: unchanged, already works (720 pts) - Historical: unchanged, already works (721 pts) All four detail charts now render: Live: 600 equity pts + filtered trade rows Paper: per-strategy equity + trades Backtest: 720 equity pts + 100 trades Historical: 721 equity pts from mainnet candles --- dashboard/static/index.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dashboard/static/index.html b/dashboard/static/index.html index 15df692..ae785ff 100644 --- a/dashboard/static/index.html +++ b/dashboard/static/index.html @@ -347,6 +347,11 @@ function openDetail(name,tab){ trades=(lastPaper.per_strategy_trades||{})[name]||[]; } else if(tab==='live'&&lastData){ ss=lastData.strategies||{}; + // Live node doesn't send per-strategy equity — use overall equity_history + equity=lastData.equity_history||[]; + // Filter trades by strategy name + var allTrades=lastData.trades||[]; + trades=allTrades.filter(function(t){return t.strategy===name||t.id===name}); } else if(tab==='backtest'&&lastBT&&lastBT[name]){ var b=lastBT[name]; currentBTName=b.name; @@ -384,7 +389,7 @@ function openDetail(name,tab){ // Equity chart if(!detChart)initDetChart(); - var eqData=equity[name]||[]; + var eqData=Array.isArray(equity)?equity:(equity[name]||[]); if(eqData.length>0){ var pts=[];for(var i=0;i