Skip to content

betting_combat.features.book

book — the book table: one row per fight (official and upcoming), what the sportsbooks priced before it, both corners explicit (fighter_a_ / fighter_b_), every value b_. Each book’s line is its close: its last line before the card started (starts_at, else the day at 00:00 UTC). A price is given three ways: the decimal odds (_odds), the chance they imply with the book’s margin in (_implied), and the fair chance (_p: the margin taken out, the books’ mean).

win each corner's open (BFO's fighter pages, 2008 on) and close: the books' mean
decimal odds, the best, the lowest and highest across books; the implied and
fair chances; the move open -> close (chance, log-odds); the path from the open
to the close (up to 10 points: range, furthest up and down, reversals, last
step, the share of steps with the final direction, where the extreme fell);
the books' count and spread, the margin at the open and the close, the
favourite at each and a flip
how it ends goes the distance; each corner by KO/TKO, submission, decision, inside the
distance (the six method lines de-vigged together); over/under 0.5 .. 4.5
rounds; starts round 2 .. 5; the draw (its line: one-sided, implied only)
by round for rounds 1 .. 5: the chance the fight reaches it, ends in it, ends in it once
it got there, and each corner wins in it, by KO/TKO and by submission. A round
after the scheduled last is 0

The books: BestFightOdds’ card pages (each book’s close: today’s books from 2021, the books of the time from the web archive’s copies before), BFO’s fighter pages (open and closing range), Cito’s books (2026), the old closing lines (static: the win line 2010 on, the method lines 2012 on). A one-sided prop (the exact round, a corner in a round, the method in a round) is de-vigged inside the set of outcomes it belongs to: the rounds and the decision, the corners’ rounds and decisions, the six methods.

What no book quoted is inferred (FILL): the method shares, the distance, how the finishes spread over the rounds and the over/unders, each from the win price, the scheduled rounds, the weight and women, by models fitted only on the fights of earlier years (the first years borrow the first year with enough fights). flag_* columns say where a value came from (0 a book’s line on the card page, 1 the archive’s copy, 2 a fighter page / another set, 3 the old lines or Cito, 4 inferred) and are never inputs.

Classes

BookInputs

The raw rows the table reads (read), or handed in (tests).

read

read(db: DBClient, schema: str = 'ufc') -> BookInputs

BookTable

Bases: FeatureTable

features.book: one row per fight, the books’ prices before it (module doc).

build

build(db: DBClient, base: Base | None = None) -> dict[str, int]

compute

compute(base: Base) -> pd.DataFrame

update

update(db: DBClient, since: Any, base: Base | None = None) -> dict[str, int]

Functions

classify

classify(market: str, outcome: str, point: float | None) -> tuple[str | None, int, bool]

A line’s event (None: not one the table reads), its round (0: none) and whether it is the ‘no’ side.

path_stats

path_stats(path: list[float] | tuple[float, ...] | None) -> dict[str, float]

A side’s BFO path (decimal odds) as its implied chance: range, the furthest above and below the open, reversals, the last step, the share of steps with the final direction, where the extreme fell.