From 96f31acf16cf36feb380af5150689da7eb79ecba Mon Sep 17 00:00:00 2001 From: chemavx Date: Thu, 11 Jun 2026 14:32:51 +0000 Subject: [PATCH] fix(metrics): count resolved trades without final_prob in resolved_count resolved_count shared the final_prob IS NOT NULL filter with calibration_score, so the resolved legacy Paxton trade (no signal data) didn't count: realized_pnl=+309.06 and wins_realized=1 but resolved_count=0. resolved_count now only requires resolution + not excluded; calibration keeps the final_prob requirement since it scores against the estimate. Validated against prod DB: new filter returns 1, old returned 0. Co-Authored-By: Claude Fable 5 --- bot/data/db.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot/data/db.py b/bot/data/db.py index a364c2c..a543f0b 100644 --- a/bot/data/db.py +++ b/bot/data/db.py @@ -247,8 +247,11 @@ class Database: COUNT(*) FILTER (WHERE closed_at IS NOT NULL) AS closed_count, -- excluded_from_metrics trades are omitted from resolved_count, -- realized_pnl, wins_realized, and calibration_score. + -- resolved_count does NOT require final_prob: legacy trades + -- without signal data still count as resolved. Calibration + -- below keeps the final_prob requirement (it needs the + -- estimated probability to score). COUNT(*) FILTER (WHERE resolution IS NOT NULL - AND final_prob IS NOT NULL AND (excluded_from_metrics IS NOT TRUE)) AS resolved_count, COALESCE(SUM(net_cost)