fix(metrics): exclude excluded_from_metrics trades from trades_dominated_by_mfld counter
CI/CD / build-and-push (push) Successful in 7s

The trades_dominated_by_mfld counter omitted the excluded_from_metrics
filter, so the admin-closed Maine governor trade inflated it to 1 while
attribution/features (which exclude such trades) were empty.

Add excluded_from_metrics IS NOT TRUE and mfld_match_status = 'accepted'
to the query so the counter is consistent with the attribution and
feature-metrics endpoints.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
chemavx
2026-06-02 09:06:06 +00:00
parent 664ecab174
commit df988a36b6
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -594,7 +594,9 @@ class Database:
""")
mfld_dominated = await conn.fetchrow("""
SELECT COUNT(*) AS cnt FROM trades
WHERE feat_mfld_lo IS NOT NULL
WHERE (excluded_from_metrics IS NOT TRUE)
AND mfld_match_status = 'accepted'
AND feat_mfld_lo IS NOT NULL
AND ABS(feat_mfld_lo) > 0.0001
AND ABS(feat_mfld_lo) > ABS(COALESCE(feat_fg_lo, 0))
AND ABS(feat_mfld_lo) > ABS(COALESCE(feat_mom_lo, 0))