gm
Deploy Iddaai Backend / build-and-deploy (push) Successful in 1m16s

This commit is contained in:
2026-06-10 22:48:05 +03:00
parent 950add373f
commit bb911176df
3 changed files with 60 additions and 7 deletions
+21 -4
View File
@@ -263,7 +263,14 @@ class BettingBrain:
"OE": -12.0,
}
def judge(self, package: Dict[str, Any]) -> Dict[str, Any]:
def judge(
self,
package: Dict[str, Any],
ms_real_odds: Optional[Dict[str, float]] = None,
) -> Dict[str, Any]:
# V35c: real bookmaker MS odds (from odds_data) for reference rows —
# the brain must never display synthetic 1/p "fair odds" as offered.
self._ms_real_odds = ms_real_odds if isinstance(ms_real_odds, dict) else {}
v27_engine = package.get("v27_engine")
if not isinstance(v27_engine, dict):
return package
@@ -916,9 +923,13 @@ class BettingBrain:
prob = self._safe_float(probs.get(pick), 0.0)
if prob is None or prob <= 0.0:
continue
implied_odd = round(1.0 / prob, 2) if prob > 0.01 else 0.0
ref_odd = existing_odds_by_pick.get(pick) or implied_odd
rows[key] = {
# V35c: only REAL bookmaker odds may be displayed. The old fallback
# showed synthetic fair-odds (1/prob) as "Oran" — users could read
# it as an offered price (e.g. X shown at 4.53 while the bulletin
# offered ~3.58). No real price → odds 0.0 and the FE renders "-".
real = self._safe_float(getattr(self, "_ms_real_odds", {}).get(pick), 0.0) or 0.0
ref_odd = existing_odds_by_pick.get(pick) or (real if real > 1.01 else 0.0)
row = {
"market": "MS",
"pick": pick,
"probability": round(prob, 4),
@@ -932,6 +943,12 @@ class BettingBrain:
"bet_grade": "PASS",
"decision_reasons": ["underdog_reference_for_completeness"],
}
if ref_odd > 1.01:
# honest economics vs the real price (vig shows as it truly is)
row["implied_prob"] = round(1.0 / ref_odd, 4)
row["ev_edge"] = round(prob * ref_odd - 1.0, 4)
row["edge"] = row["ev_edge"]
rows[key] = row
@staticmethod
def _merge_row(existing: Optional[Dict[str, Any]], incoming: Dict[str, Any]) -> Dict[str, Any]: