diff --git a/dashboard/static/index.html b/dashboard/static/index.html index 914c185..8eb9334 100644 --- a/dashboard/static/index.html +++ b/dashboard/static/index.html @@ -214,10 +214,11 @@ function initDetChart(){ // ═══════════ Tab switching ═══════════ function switchTab(t){ currentTab=t; - ['live','paper','backtest'].forEach(function(x){document.getElementById('tl-'+x).className=t===x?'tab on':'tab'}); + ['live','paper','backtest','historical'].forEach(function(x){document.getElementById('tl-'+x).className=t===x?'tab on':'tab'}); document.getElementById('pnl-live').className=t==='live'?'panel show':'panel'; document.getElementById('pnl-paper').className=t==='paper'?'panel show':'panel'; document.getElementById('pnl-backtest').className=t==='backtest'?'panel show':'panel'; + document.getElementById('pnl-historical').className=t==='historical'?'panel show':'panel'; if(t==='live'&&lastData)renLive(lastData); if(t==='paper'&&lastPaper)renPaper(lastPaper); if(t==='backtest')loadBT(); @@ -402,6 +403,35 @@ function loadBT(){ }) } +// ═══════════ Historical backtests ═══════════ +var lastHist={}; +function loadHistBT(){ + fetch('/cv/api/backtests/historical').then(function(r){return r.json()}).then(function(data){ + lastHist={}; + for(var i=0;i
'+s+'
30d '+b.coin+' · Mainnet
REAL DATA
'+(pnl>=0?'+':'')+pnl.toFixed(2)+'%
Sharpe: '+b.sharpe.toFixed(2)+'DD: '+(b.max_dd*100).toFixed(2)+'%Win: '+Math.round(b.win_rate*100)+'%
'; + } + document.getElementById('hist-sgrid').innerHTML=h||'
No historical backtests. Run: python backtests/historical_runner.py --coin BTC --strategy all
'; + }) +} +function openHistDetail(strat){ + var b=lastHist[strat];if(!b)return; + document.getElementById('detail-overlay').classList.add('on'); + document.getElementById('fee-toggle-wrap').style.display='inline'; + document.getElementById('fee-tier-sel').style.display='inline'; + document.getElementById('stake-tier-sel').style.display='inline'; + document.getElementById('dl-csv').style.display='none'; + document.getElementById('fee-toggle').checked=true; feeOn=true; currentBTName=b.name; + document.getElementById('det-name').textContent=strat+' (Historical '+b.coin+')'; + fetch('/cv/api/backtest/historical/'+encodeURIComponent(b.name)).then(function(r){return r.json()}).then(function(full){ + lastBTFull=full; renderBTDetail(full); + }).catch(function(e){ + document.getElementById('det-trades').innerHTML='Failed: '+e.message+''; + }); +} + // ═══════════ Init ═══════════ initDetChart();connect();loadBT(); // ═══════════ Risk Analytics ═══════════