proj-v1: book-implied from book_odds (grades carry odds, not fair_prob)
The live fingerprint showed proj_book_implied null on every real row: grades carry book_odds/locked_odds (e.g. -264) but NOT a de-vigged fair_prob, so keying the book comparison off fair_prob yielded null. The book ODDS are exactly "the book's implied probability" the handicapper test needs. Now proj_book_implied + the traded rung's book_implied derive from americanToImplied(book_odds), expressed on the OVER basis (under props → 1 - implied) so it's directly comparable to our P(≥rung). Vigged (a known offset the ledger measures both sides of). proj-v1 suites 24/24. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCNgGSt5qvcLxaeQqa7Zpj
This commit is contained in:
@@ -57,6 +57,13 @@ const abbrOf = (team) => {
|
||||
return NAME_TO_ABBR[s.toLowerCase()] || null;
|
||||
};
|
||||
|
||||
/** American odds → implied probability (vigged). Null on absent/zero. */
|
||||
function americanToImplied(odds) {
|
||||
const o = num(odds);
|
||||
if (o == null || o === 0) return null;
|
||||
return o < 0 ? (-o) / (-o + 100) : 100 / (o + 100);
|
||||
}
|
||||
|
||||
/** Park factor (multiplier ~1.0) for a team's home venue, or null. */
|
||||
function parkFactorFor(teamAbbr) {
|
||||
if (!teamAbbr) return null;
|
||||
@@ -179,13 +186,19 @@ function projectProp({
|
||||
const rungs = dist.ladder(nb, LADDER_MAX);
|
||||
|
||||
// ── LADDER + book implied (only the traded rung has a book number) ────────
|
||||
// The BOOK's implied probability comes from the book ODDS (grades carry
|
||||
// book_odds, not a de-vigged fair_prob). This is the vigged implied — a known
|
||||
// constant offset the ledger measures on both sides — expressed on the OVER
|
||||
// basis so it's directly comparable to our P(≥ rung).
|
||||
const tradedRung = isNum(line) ? Math.max(1, Math.ceil(line)) : null;
|
||||
const fairProb = num(grade && grade.fair_prob); // de-vigged, graded direction
|
||||
const bookOdds = num(grade && (grade.book_odds != null ? grade.book_odds : grade.locked_odds));
|
||||
const rawImplied = americanToImplied(bookOdds);
|
||||
const bookOverImplied = rawImplied == null ? null
|
||||
: Math.round((direction === 'under' ? 1 - rawImplied : rawImplied) * 1000) / 1000;
|
||||
const ladderOut = rungs.map((r) => ({
|
||||
rung: r.rung,
|
||||
p_at_least: r.p_at_least,
|
||||
book_implied: (tradedRung != null && r.rung === tradedRung && direction === 'over' && fairProb != null)
|
||||
? Math.round(fairProb * 1000) / 1000 : null,
|
||||
book_implied: (tradedRung != null && r.rung === tradedRung) ? bookOverImplied : null,
|
||||
}));
|
||||
const pOverLine = tradedRung != null ? dist.round3(dist.nbSurvival(nb.r, nb.p, tradedRung)) : null;
|
||||
|
||||
@@ -194,7 +207,7 @@ function projectProp({
|
||||
proj_point: point,
|
||||
proj_line: line,
|
||||
proj_p_over_line: pOverLine,
|
||||
proj_book_implied: (direction === 'over' && fairProb != null) ? Math.round(fairProb * 1000) / 1000 : null,
|
||||
proj_book_implied: bookOverImplied,
|
||||
proj_distribution: {
|
||||
family: 'negative_binomial',
|
||||
r: dist.round3(nb.r), p: dist.round3(nb.p),
|
||||
|
||||
Reference in New Issue
Block a user