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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user