Fix win_rate() for Kalman Pairs: add net_pnl/gross_pnl field support

Bug: win_rate() only checked pnl_net/pnl_gross/pnl fields,
but Kalman backtests save trades with net_pnl/gross_pnl (underscore-first).
Result: all 4 Kalman assets showed 0% win on 27-35 trades.

After fix:
  BTC: 0% → 45% (16/35)
  ETH: 0% → 47% (16/34)
  HYPE: 0% → 51% (14/27)
  VVV: 0% → 57% (19/33)

Also corrected paper trader coin assignments for Mean Reversion
and Momentum Breakout (was BTC, should be ETH).
This commit is contained in:
ramseshk
2026-08-06 08:26:35 +00:00
parent 37b8496dc2
commit a6905f2691
5 changed files with 7 additions and 13467 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -40,5 +40,7 @@ def max_drawdown(equity: list[float]) -> float:
def win_rate(trades: list[dict]) -> float:
if not trades:
return 0.0
tp = sum(1 for t in trades if (t.get("pnl_net") or t.get("pnl_gross") or t.get("pnl", 0)) > 0)
tp = sum(1 for t in trades if (
(t.get("pnl_net") or t.get("net_pnl") or t.get("pnl_gross") or t.get("gross_pnl") or t.get("pnl", 0)) > 0
))
return tp / len(trades)