Skip to content

betting_combat.jobs.ufc

ufc.py — the base tables’ flow (schema ufc): the three feeds and the card’s live run, on the rounds flows’ footing (RoundsContext: each step’s data_jobs row, the monitoring ledger, the launch gate). Every row is seeded disabled and every sensor born stopped; nothing runs on a calendar of its own: every job is the card’s (before, on the day, live, after) or a build by hand.

UfcFlow
steps land_ufc_catalog events, fighters, bouts, markets (``feeds.catalog``)
land_ufc_market_data trades and minutes of every market (``feeds.market_data``)
land_ufc_fight_data official rounds, snapshots, odds, careers, rankings, judges
land_ufc_static_profiles the static history (the legacy store's files: sportsbook
lines, bookmakers' method odds, rankings at each card,
Kalshi card quotes, Wikipedia's card sections) and UFC.com's
athlete pages with the pedigree read from them
build_ufc_features every feature table from the base (``features.run``: fight ->
outcomes -> fighter_stats -> profile -> career -> book -> market
-> labels -> final)
refresh_ufc_prices the price simulator (``models.price_simulator.refresh``): the last
model checked on the new cards, refitted on every quote, out of
sample per card, saved; features.prices rewritten
refresh_ufc_inround the in-round tables (``features.inround_blocks.refresh``): the saved
stats simulator scored on the new cards (features.simulator_rounds;
a refit on demand only), the window's blocks, the draws, their
prices, labels
refresh_ufc_rounds the rounds strategy on the blocks (``strategies.rounds.refresh``):
the saved primary (LightGBM from the price) checked on the new
cards, refitted on every block row with its inputs, saved
refresh_ufc_card one card's listings in seconds and its readiness check; the
due gaps are findings (the run's receipt partial)
run_ufc_card the card live (``live.card``): clocks, bell stats, books; traded by the
strategies whose ``ufc_executions`` rows are on (``execution.card``)
jobs ufc_build the whole history (by hand: hours of paced calls)
ufc_update launched by ``ufc_card_data_sensor`` three times a card: before it
(from 18:00 UTC two days before its first fight), on its day (from 8 h
before its first fight: late replacements, the lines, the features
the live rows start from) and after it (from 12:00 UTC the morning
after its last fight): results, stats, trades, minutes, judges, odds,
rankings; one run each per card
ufc_card_refresh launched by ``ufc_card_sensor``: every 30 min from 36 h before a
card's first fight, every 2 min from 10 h before to its end
ufc_card_session launched by ``ufc_card_sensor`` an hour before the first fight;
one run per card (a failed run is relaunched under a new key)

The card’s times come from the catalog itself (its bouts’ scheduled_at): the sensor reads the tables, never a vendor.

Classes

CardTimes

UfcFlow

Bases: RoundsContext

build_ufc_features

build_ufc_features() -> None

Every feature table from the base (a build: every row; an update: the rows of the window, the history recomputed whole).

build_ufc_group_bars

build_ufc_group_bars() -> None

The information bars of every market group of every fight (features.group_bars / group_bar_members / group_flows, features.group_bars): a build every card in date order; an update the cards from the window’s start on (their sizes from the stored flows of the cards before).

land_ufc_catalog

land_ufc_catalog() -> None

Events, fighters, bouts (results), markets from every provider, on our ids.

land_ufc_fight_data

land_ufc_fight_data() -> None

Official rounds, snapshots, odds, careers, rankings (Cito) and judges (MMADecisions).

land_ufc_market_data

land_ufc_market_data() -> None

Trades and minutes of every market (a build: from 2025-05; an update: the window).

land_ufc_static_profiles

land_ufc_static_profiles() -> None

The static history from the legacy store (feeds.static), then UFC.com’s pages of the fighters due one (a build: every fighter without one; an update: the window) and the pedigree of each new page (when an Anthropic key is set: else noted, never a failure).

refresh_ufc_card

refresh_ufc_card() -> None

One card’s listings (Cito’s card, Kalshi’s fights and new markets, the venues’ open fights) and its readiness check: every due gap is a finding, an unbound market too.

refresh_ufc_inround

refresh_ufc_inround() -> None

The in-round tables (features.inround_blocks.refresh, models.folds). A build: the stats and block price simulators out of sample on every card they learn from, their final fits forecasting the rest, features.inround_blocks and its labels written whole. An update: the saved simulators draw the new cards (scored: features.simulator_rounds), those fights’ rows written, then each refitted with the new cards. The rounds strategy’s rows are read from them.

refresh_ufc_prices

refresh_ufc_prices() -> None

The price level at every round start (models.price_simulator, models.folds). A build: every quoted card priced out of sample (one card held out at a time), the final fit forecasting the rest, features.prices written whole. An update: the saved model prices the new cards (out of sample for it), those rows written, then the model refitted with them and saved.

refresh_ufc_rounds

refresh_ufc_rounds() -> None

The rounds strategy on the blocks (strategies.rounds.refresh): the saved primary (LightGBM from the price) checked on the cards since it was fitted, refitted on every labelled block row with its saved inputs and settings, saved (the walk-forward: each card traded by the fit made after the card before it).

refresh_ufc_rounds_bars

refresh_ufc_rounds_bars() -> None

The rounds strategy on the bars (strategies.rounds_bars): a build = every card’s rows predicted out of sample by a fit on every other card (features.rounds_bars_oos), the final fit saved; an update = the saved fit scores the new cards’ rows (their out-of-sample rows), then the fit redone on everything and saved.

run_ufc_card

run_ufc_card() -> None

The card live, from an hour before its first fight until every fight is over; traded by every strategy whose ufc_executions rows are on (execution.card: paper or live per venue row; none on: recorded only).

ufc_card_data_sensor

ufc_card_data_sensor(context: dg.SensorEvaluationContext)

The card’s data update, before it and after it (data_tick): one run each.

ufc_card_refresh_sensor

ufc_card_refresh_sensor(context: dg.SensorEvaluationContext)

The next card’s listings: every 30 min from 36 h before its first fight, every 2 min from 10 h before until its live run starts an hour before (the session refreshes them itself from there: one catalog writer); one run key per slot.

ufc_card_session_sensor

ufc_card_session_sensor(context: dg.SensorEvaluationContext)

The card live from an hour before its first fight: one run per card, relaunched under a new key if a run fails before the card is over.

Functions

card_tick

card_tick(card: CardTimes | None, now: dt.datetime) -> tuple[str | None, str | None, str]

(the refresh run key, the session’s card or None, why): what the card sensor does now.

card_times

card_times(events: Iterable[Event], bouts: Iterable[Bout], now: dt.datetime) -> CardTimes | None

The next card not over yet.

cards_of

cards_of(events: Iterable[Event], bouts: Iterable[Bout]) -> list[CardTimes]

Every card with listed fights: its date and its first and last fights’ starts (fights fought count: a card over is still a card, its post-card update due).

data_due

data_due(cards: list[CardTimes], now: dt.datetime) -> list[tuple[str, CardTimes, str]]

Every update due now, (run key, card, why): before a card (from 18:00 UTC two days before its first fight until 10 h before it), on its day (from 8 h before its first fight until 3 h before: the late replacements, the card’s lines, every feature table as of the day - the live rows’ inputs; the card run refreshes the lines once more itself) and after it (from 12:00 UTC the morning after its last fight, for three days, so a missed tick is caught up).

data_tick

data_tick(cards: list[CardTimes], now: dt.datetime, launched: Iterable[str] = ()) -> tuple[str | None, CardTimes | None, str]

(the update’s run key, its card, why): the first update due now not launched yet (two cards close together each get theirs).

rows

rows(what: str) -> dict[str, str]

A step’s two data_jobs rows: build_ufc_<what> and update_ufc_<what>.