Add detailed PnL and duration stats to dashboard
This commit is contained in:
@@ -360,6 +360,7 @@ func (d *Dashboard) broadcastLoop() {
|
||||
|
||||
// 4. Stats + connection status (P3-5)
|
||||
converged, diverged, flat, total := d.trader.GetClosedStats()
|
||||
detail := d.trader.GetDetailedStats()
|
||||
stats := map[string]interface{}{
|
||||
"total_trades": total,
|
||||
"converged": converged,
|
||||
@@ -367,6 +368,19 @@ func (d *Dashboard) broadcastLoop() {
|
||||
"flat": flat,
|
||||
"open_positions": len(positions),
|
||||
"coins": len(prices),
|
||||
|
||||
// Detailed PnL & duration stats (session only)
|
||||
"detail": map[string]interface{}{
|
||||
"total_pnl": detail.TotalPnlPct,
|
||||
"avg_pnl": detail.AvgPnlPct,
|
||||
"max_profit": detail.MaxProfitPct,
|
||||
"max_loss": detail.MaxLossPct,
|
||||
"avg_dur": detail.AvgDuration,
|
||||
"win_rate": detail.WinRate,
|
||||
"wins": detail.WinningTrades,
|
||||
"losses": detail.LosingTrades,
|
||||
"total_dur": detail.TotalDuration,
|
||||
},
|
||||
}
|
||||
|
||||
// Connection status
|
||||
|
||||
Reference in New Issue
Block a user