fix(metrics): count resolved trades without final_prob in resolved_count
CI/CD / build-and-push (push) Successful in 8s
CI/CD / build-and-push (push) Successful in 8s
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
5aa54eb423
commit
96f31acf16
+4
-1
@@ -247,8 +247,11 @@ class Database:
|
|||||||
COUNT(*) FILTER (WHERE closed_at IS NOT NULL) AS closed_count,
|
COUNT(*) FILTER (WHERE closed_at IS NOT NULL) AS closed_count,
|
||||||
-- excluded_from_metrics trades are omitted from resolved_count,
|
-- excluded_from_metrics trades are omitted from resolved_count,
|
||||||
-- realized_pnl, wins_realized, and calibration_score.
|
-- 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
|
COUNT(*) FILTER (WHERE resolution IS NOT NULL
|
||||||
AND final_prob IS NOT NULL
|
|
||||||
AND (excluded_from_metrics IS NOT TRUE)) AS resolved_count,
|
AND (excluded_from_metrics IS NOT TRUE)) AS resolved_count,
|
||||||
|
|
||||||
COALESCE(SUM(net_cost)
|
COALESCE(SUM(net_cost)
|
||||||
|
|||||||
Reference in New Issue
Block a user