gg3
Deploy Iddaai Backend / build-and-deploy (push) Successful in 32s

This commit is contained in:
2026-05-25 02:19:12 +03:00
parent fa48f87f53
commit b619c2454a
22 changed files with 120 additions and 10 deletions
+46
View File
@@ -312,6 +312,52 @@ class BettingBrain:
if market in {"HT", "HTFT", "OE"} and score < 86.0:
vetoes.append("volatile_market_requires_exceptional_evidence")
# Cross-market reversal risk for MS/DC picks.
# If HTFT model says the *opposite* of our MS pick is likely (a
# reversal scenario like 1/2 or 2/1), the MS pick is fragile even
# when its own calibrated_confidence is high. The Manchester City
# 1-0 → 1-2 case is exactly this: MS=1 looked solid but HTFT 1/2
# carried real probability mass that the MS scorer ignored.
if market == "MS" and pick in ("1", "2"):
board = package.get("market_board") or {}
htft_payload = board.get("HTFT") if isinstance(board, dict) else None
htft_probs = (
htft_payload.get("probs", {})
if isinstance(htft_payload, dict) else {}
)
risk_payload = package.get("risk") or {}
if not htft_probs and isinstance(risk_payload, dict):
htft_probs = risk_payload.get("ht_ft_probs", {}) or {}
# Reversal outcomes that would make this MS pick lose despite
# the team leading at half-time / trailing at half-time.
if pick == "1":
# Picked home win. Threats: 1/2 (led, lost) and 1/X (led, drew).
reversal_keys = ("1/2", "1/X")
drift_keys = ("X/2",)
else:
# Picked away win. Threats: 2/1, 2/X. Drift: X/1.
reversal_keys = ("2/1", "2/X")
drift_keys = ("X/1",)
reversal_prob = sum(
self._safe_float(htft_probs.get(key), 0.0) or 0.0
for key in reversal_keys
)
drift_prob = sum(
self._safe_float(htft_probs.get(key), 0.0) or 0.0
for key in drift_keys
)
combined_risk = reversal_prob + 0.5 * drift_prob
if combined_risk >= 0.25:
score -= 28.0
vetoes.append("htft_reversal_risk_high")
issues.append(f"htft_reversal_prob={combined_risk:.2f}")
elif combined_risk >= 0.15:
score -= 14.0
issues.append(f"htft_reversal_prob_moderate={combined_risk:.2f}")
elif combined_risk >= 0.10:
score -= 6.0
issues.append(f"htft_reversal_prob_minor={combined_risk:.2f}")
# Sniper override: bypass eligible vetoes when value sniper triggered
sniper_bypassed: List[str] = []
if is_value_sniper and vetoes: