Show average profit and loss in option stats panel.

Expose avg_win and avg_loss from stats API and update chart labels and values to match the average-based P/L ratio.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-11 09:29:26 +08:00
parent bf2d668d3c
commit 68733eb4f9
4 changed files with 17 additions and 13 deletions
+2
View File
@@ -93,6 +93,8 @@ def compute_options_stats(get_db) -> dict[str, Any]:
"loss_count": len(losses),
"win_rate": win_rate,
"profit_loss_ratio": profit_loss_ratio_from_averages(avg_win, avg_loss),
"avg_win": round(avg_win, 4) if avg_win is not None else None,
"avg_loss": round(abs(avg_loss), 4) if avg_loss is not None else None,
"total_profit": round(sum(wins), 4) if wins else 0.0,
"total_loss": round(abs(sum(losses)), 4) if losses else 0.0,
"avg_hold_sec": _avg_seconds(all_holds),