From 1ece7ec7c64c070e880fd44f856206ac31d4c1ad Mon Sep 17 00:00:00 2001 From: ramseshk Date: Tue, 4 Aug 2026 04:37:27 +0000 Subject: [PATCH] Per-strategy equity curves + $100K paper capital MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Paper trader now tracks individual equity history per strategy (strategy_equity dict with deque per strategy). Metrics file exports per-strategy data for dashboard rendering. Dashboard paper chart upgraded to 7 overlaid area series: - Each strategy gets its own colored curve (green, blue, purple, etc.) - 300px height for better visibility of multiple lines - Color palette distinguishes strategies at a glance $100K total capital: $10K per strategy × 7 + $30K reserve. Exeria Charts evaluated: excellent library (Benzinga award winner, Canvas/WebGL, exchange connectors) but requires npm+bundler — not suitable for single-file dashboard. Lightweight-charts remains the right choice for our architecture. --- dashboard/static/index.html | 32 ++++++++++++++++++++++++++++---- live/paper_trader.py | 5 +++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/dashboard/static/index.html b/dashboard/static/index.html index 43236c4..3c4d3d6 100644 --- a/dashboard/static/index.html +++ b/dashboard/static/index.html @@ -100,7 +100,7 @@ footer{text-align:center;padding:20px;font-size:10px;color:#3f3f46}footer a{colo
-

Equity Curve real-time · Hyperliquid Mainnet (simulated fills)

+

Equity Curve per-strategy · Hyperliquid Mainnet (simulated)

Trade Log

TimeStrategySideSizePriceFeePnL
@@ -117,7 +117,20 @@ footer{text-align:center;padding:20px;font-size:10px;color:#3f3f46}footer a{colo var tab='live',lastData=null,lastPaper=null; function mkChart(el,w,h){var c=LightweightCharts.createChart(el,{layout:{background:{color:'transparent'},textColor:'#8b8b96'},grid:{vertLines:{color:'rgba(255,255,255,0.03)'},horzLines:{color:'rgba(255,255,255,0.03)'}},rightPriceScale:{borderColor:'rgba(255,255,255,0.06)'},timeScale:{borderColor:'rgba(255,255,255,0.06)',timeVisible:true},crosshair:{mode:0},width:w,height:h});return c} var eqChart=mkChart(document.getElementById('eq-chart'),0,0);var eqSer=eqChart.addAreaSeries({lineColor:'#3b82f6',topColor:'rgba(59,130,246,0.15)',bottomColor:'rgba(59,130,246,0.02)',lineWidth:2}); -var paperChart=mkChart(document.getElementById('paper-chart'),0,0);var paperSer=paperChart.addAreaSeries({lineColor:'#a855f7',topColor:'rgba(168,85,247,0.12)',bottomColor:'rgba(168,85,247,0.02)',lineWidth:2}); +var paperChart=mkChart(document.getElementById('paper-chart'),0,0); +// Per-strategy equity series (7 strategies, 7 colors) +var STRAT_COLORS = ['#22c55e','#3b82f6','#a855f7','#f59e0b','#ef4444','#06b6d4','#ec4899']; +var paperStrataSeries = {}; +function getStratSeries(name){ + if(!paperStrataSeries[name]){ + var idx = Object.keys(paperStrataSeries).length; + var color = STRAT_COLORS[idx % STRAT_COLORS.length]; + paperStrataSeries[name] = paperChart.addAreaSeries({ + lineColor: color, topColor: color+'26', bottomColor: color+'05', lineWidth: 1.5 + }); + } + return paperStrataSeries[name]; +} var btChart=mkChart(document.getElementById('bt-chart'),0,0);var btSer=btChart.addAreaSeries({lineColor:'#a855f7',topColor:'rgba(168,85,247,0.12)',bottomColor:'rgba(168,85,247,0.02)',lineWidth:2}); function fitCharts(){ @@ -196,8 +209,19 @@ function renLive(d){ function renPaper(d){ if(!d)return; var pnl=d.total_pnl||0;document.getElementById('stpnl').textContent=(pnl>=0?'+':'')+'$'+Math.abs(pnl).toFixed(2);document.getElementById('stpnl').className='pnl '+(pnl>=0?'up':'dn'); - document.getElementById('stpct').textContent='Mainnet Paper · Equity: $'+((d.total_equity||5000)).toFixed(2)+' · BTC: $'+(d.btc_price||0).toLocaleString('en-US',{maximumFractionDigits:0}); - renGrid('paper-grid',d.strategies||{},d.base_equity||5000,d.reserve||1000,'paper-stats','paper-tb',paperChart,paperSer,d.equity_history||[],d.trades||[]); + document.getElementById('stpct').textContent='Mainnet Paper · Equity: $'+(d.total_equity||100000).toFixed(0)+' · BTC: $'+(d.btc_price||0).toLocaleString('en-US',{maximumFractionDigits:0}); + renGrid('paper-grid',d.strategies||{},d.base_equity||100000,d.reserve||30000,'paper-stats','paper-tb',paperChart,null,d.equity_history||[],d.trades||[]); + // Per-strategy equity curves + var seq = d.strategy_equity || {}; + var keyz = Object.keys(seq); + for(var i=0;i0){ + var arr=[];for(var j=0;j