From 98e7f5fe733951d5c8b05e1216aad9787374d596 Mon Sep 17 00:00:00 2001 From: chemavx Date: Tue, 14 Apr 2026 08:15:49 +0000 Subject: [PATCH] feat(logging): log prior/estimate/edge/reason for every evaluated market Every market now emits an INFO line: TRADE/SKIP | cat=... | prior=... | est=... | edge=... | conf=... | dir=... | signals=... [| reason=...] Unsupported-category and no-external-signals early exits also log at INFO so the full evaluation funnel is visible without changing log level. Co-Authored-By: Claude Sonnet 4.6 --- bot/strategy/bayesian.py | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/bot/strategy/bayesian.py b/bot/strategy/bayesian.py index 69a81a6..9fea8db 100644 --- a/bot/strategy/bayesian.py +++ b/bot/strategy/bayesian.py @@ -95,10 +95,17 @@ class BayesianStrategy: or is_politics or is_tech or is_events ) if not is_any_supported: - log.debug("Skipping unsupported market: %s", market.question[:60]) + log.info( + "SKIP %-50s | reason=unsupported category=%r", + market.question[:50], category, + ) return None if not ext.valid: + log.info( + "SKIP %-50s | reason=no external signals", + market.question[:50], + ) return None # Can't reason without external data # --- Bayesian probability estimation --- @@ -179,12 +186,33 @@ class BayesianStrategy: agreement = sum(1 for a in adjustments if (a > 0) == (total_adj > 0)) confidence = min(confidence_cap, 0.4 + (agreement / max(len(adjustments), 1)) * 0.5) + # Log evaluation result for every market + action = "TRADE" if (abs_edge >= MIN_EDGE and confidence >= MIN_CONFIDENCE) else "SKIP" + skip_reason = "" + if action == "SKIP": + reasons = [] + if abs_edge < MIN_EDGE: + reasons.append(f"edge={abs_edge:.3f}<{MIN_EDGE}") + if confidence < MIN_CONFIDENCE: + reasons.append(f"conf={confidence:.2f}<{MIN_CONFIDENCE}") + skip_reason = " | reason=" + ",".join(reasons) + + log.info( + "%-5s %-50s | cat=%-12s | prior=%.3f | est=%.3f | edge=%+.3f | conf=%.2f | dir=%-8s | signals=%s%s", + action, + market.question[:50], + category, + prior, + estimated_prob, + edge, + confidence, + direction, + ", ".join(sources[1:]) or "none", + skip_reason, + ) + # Filter: only trade if edge and confidence thresholds met if abs_edge < MIN_EDGE or confidence < MIN_CONFIDENCE: - log.debug( - "No signal: edge=%.3f confidence=%.2f market=%s", - abs_edge, confidence, market.question[:40] - ) return None reasoning = (