diff --git a/public/index.html b/public/index.html index 5c06ec1..81a3f5a 100644 --- a/public/index.html +++ b/public/index.html @@ -264,7 +264,7 @@ async function loadChart(h=8){ curH=h;['b2','b8','b24','b72'].forEach(id=>document.getElementById(id)?.classList.remove('on')); document.getElementById({2:'b2',8:'b8',24:'b24',72:'b72'}[h])?.classList.add('on'); const {summary,history}=await fetch('/api/pnl-history?hours='+h).then(r=>r.json()); - if(summary){const set=(id,v)=>{const e=document.getElementById(id);e.textContent=fmt(v);e.className='pval '+cls(v)};set('v-u',summary.totalUnrealised);set('v-r',summary.totalRealised);set('v-t',summary.totalPnl);document.getElementById('s-pos').textContent=summary.openPositions;} + if(summary){const set=(id,v)=>{const e=document.getElementById(id);e.textContent=fmt(v);e.className='pval '+cls(v)};set('v-u',summary.totalUnrealised);set('v-r',summary.totalRealised);set('v-t',summary.totalPnl);document.getElementById('s-pos').textContent=summary.openPositions;var bEl=document.getElementById('s-booked');if(bEl){bEl.textContent=fmt(summary.bookedPnl||0);bEl.className='sval '+cls(summary.bookedPnl||0);}} const canvas=document.getElementById('pnl-chart'),empty=document.getElementById('chart-empty'); if(!history||history.length<2){canvas.style.display='none';empty.classList.add('show');return;} canvas.style.display='block';empty.classList.remove('show');