polymarket slug

This commit is contained in:
2026-06-24 11:28:26 -05:00
parent 253b8cfbcd
commit ddaa1db876
4 changed files with 185 additions and 57 deletions

View File

@@ -23,18 +23,45 @@ export function saveOverrides(overrides: SimOverrides): void {
} catch { /* quota exceeded */ }
}
// Plausibles Standardergebnis aus Polymarket-Wahrscheinlichkeiten.
// Favorit gewinnt 1:0; bei hoher W'keit (>=0.65) 2:0.
// Ohne prob: Gruppe → 1:1, K.o. → null (Nutzer muss selbst eingeben).
// Plausibles Standardergebnis aus Polymarket-3-Wege-Wahrscheinlichkeiten.
//
// Schwellen (zentral):
// Draw am höchsten ODER max(home,away) < 0.40 → 0:0 (Gruppe) / 1:0 Heim (K.o.)
// Favorit 0.400.60 → 1:0
// Favorit 0.600.78 → 2:0
// Favorit > 0.78 → 3:0
//
// Beispiele:
// SchweizKanada (0.385/0.315/0.295) → 0:0
// SchottlandBrasilien (0.10/0.17/0.75) → 0:2
// MarokkoHaiti (0.83/0.13/0.05) → 3:0
export function defaultScore(match: Match): { homeScore: number; awayScore: number } | null {
const prob = match.prob;
if (!prob) {
if (match.stage === "GROUP") return { homeScore: 1, awayScore: 1 };
return null;
}
const maxFA = Math.max(prob.home, prob.away);
const isDraw = prob.draw > prob.home && prob.draw > prob.away;
const isGroup = match.stage === "GROUP";
if (isDraw || maxFA < 0.40) {
if (isGroup) return { homeScore: 0, awayScore: 0 };
return { homeScore: 1, awayScore: 0 }; // K.o.: knapp Heim (kein Remis)
}
// Favorit bestimmen
const homeFav = prob.home >= prob.away;
const favProb = Math.max(prob.home, prob.away);
const goals = favProb >= 0.65 ? 2 : 1;
let goals: number;
if (maxFA > 0.78) {
goals = 3;
} else if (maxFA >= 0.60) {
goals = 2;
} else {
goals = 1; // 0.400.60
}
if (homeFav) return { homeScore: goals, awayScore: 0 };
return { homeScore: 0, awayScore: goals };
}