Add win rate and profit-loss ratio to archive stats.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-21 09:13:37 +08:00
parent c05afbbedf
commit c0f3606ecc
5 changed files with 55 additions and 4 deletions
+4
View File
@@ -291,10 +291,14 @@ def test_compute_period_stats_win_loss_metrics():
assert st["avg_loss"] == -4.5
assert st["max_win"] == 10.0
assert st["max_loss"] == -6.0
assert st["win_rate"] == 50.0
assert st["profit_loss_ratio"] == round(7.0 / 4.5, 2)
assert st["sick_count"] == 1
assert st["pnl_total"] == 5.0
assert st["pnl_ex_sick"] == 8.0
assert st["by_exchange"]["binance"]["win_count"] == 2
assert st["by_exchange"]["binance"]["win_rate"] == 100.0
assert st["by_exchange"]["binance"]["profit_loss_ratio"] is None
def test_list_daily_trades_search_filters_stats():