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
@@ -223,7 +223,9 @@ async def get_manifold_matches():
summary.all_time — accepted/rejected/no_results across every matcher version. summary.all_time — accepted/rejected/no_results across every matcher version.
summary.legacy.accepted_without_outcome_type — pre-outcome-guard accepted summary.legacy.accepted_without_outcome_type — pre-outcome-guard accepted
records that the current matcher would reject (not counted in current_version). records that the current matcher would reject (not counted in current_version).
summary.trades_dominated_by_mfld — open trades where feat_mfld_lo is the largest signal. summary.trades_dominated_by_mfld — non-excluded accepted-match trades where
feat_mfld_lo is the largest signal (consistent with attribution/features,
which also exclude excluded_from_metrics trades).
recent_matches: last 50 rows from manifold_match_audit, newest first, each recent_matches: last 50 rows from manifold_match_audit, newest first, each
tagged with matcher_version. tagged with matcher_version.
+3 -1
View File
@@ -594,7 +594,9 @@ class Database:
""") """)
mfld_dominated = await conn.fetchrow(""" mfld_dominated = await conn.fetchrow("""
SELECT COUNT(*) AS cnt FROM trades 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) > 0.0001
AND ABS(feat_mfld_lo) > ABS(COALESCE(feat_fg_lo, 0)) AND ABS(feat_mfld_lo) > ABS(COALESCE(feat_fg_lo, 0))
AND ABS(feat_mfld_lo) > ABS(COALESCE(feat_mom_lo, 0)) AND ABS(feat_mfld_lo) > ABS(COALESCE(feat_mom_lo, 0))