feat(logging): log prior/estimate/edge/reason for every evaluated market
CI/CD / build-and-push (push) Successful in 1m35s
CI/CD / build-and-push (push) Successful in 1m35s
Every market now emits an INFO line: TRADE/SKIP <question> | 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 <noreply@anthropic.com>
This commit is contained in:
@@ -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 = (
|
||||
|
||||
Reference in New Issue
Block a user