Add detailed PnL and duration stats to dashboard

This commit is contained in:
jackyu66git
2026-05-03 21:03:40 +08:00
parent a89a1f6cd8
commit 1e4a3f3b37
6 changed files with 177 additions and 10 deletions
+11
View File
@@ -206,6 +206,17 @@ eventHandlers.stats = (stats) => {
els.statPos.textContent = stats.open_positions || 0;
els.statCoins.textContent = stats.coins || 0;
// Detailed PnL stats
if (stats.detail) {
const d = stats.detail;
$('stat-total-pnl').textContent = (d.total_pnl != null) ? d.total_pnl.toFixed(2) + '%' : '—';
$('stat-avg-pnl').textContent = (d.avg_pnl != null) ? d.avg_pnl.toFixed(2) + '%' : '—';
$('stat-win-rate').textContent = (d.win_rate != null) ? d.win_rate.toFixed(1) + '%' : '—';
$('stat-max-profit').textContent = (d.max_profit != null) ? '+' + d.max_profit.toFixed(2) + '%' : '—';
$('stat-max-loss').textContent = (d.max_loss != null) ? d.max_loss.toFixed(2) + '%' : '—';
$('stat-avg-dur').textContent = d.avg_dur || '—';
}
// Connection status dots
if (stats.connections) {
const dots = Object.entries(stats.connections).map(([ex, status]) => {