betting_combat.feeds.runner
runner.py — every feed in order, the one entry the jobs call (and a person can run): the whole history, or the recent past, into the database it is given.
Providers the clients a run uses (from the environment's keys: ``Providers.from_env``)build_all the history: catalog (seeding today's ids when empty) → market data → fight dataupdate_all the recent past and the cards ahead, the same orderbfo_store where BestFightOdds' pages are kept (``BFO_STORE``, else a fresh folder)refresh_card one card's listings, in seconds (the card-day poll), and its readiness check
python -m betting_combat.feeds.runner build --host … [--start 2025-05-01] [--end …]python -m betting_combat.feeds.runner update --host …python -m betting_combat.feeds.runner refresh --host … --day 2026-11-14Each step is rerunnable: an unchanged row is never touched, so a second run writes nothing.
Classes
Providers
from_env
from_env(build: bool = False) -> Providersbuild: Kalshi paced at BUILD_RATE (a manual build, never on a card day: the
card’s own runs keep the default 10 of the tier’s 20 reads a second).
Functions
bfo_store
bfo_store() -> PathBestFightOdds’ page store: BFO_STORE (kept between runs: a page that cannot change is
never asked again), else a fresh folder (the run asks for every page of its range).
build_all
build_all(db: DBClient, p: Providers, registry_db: DBClient | None = None, start: dt.date = dt.date(1993, 11, 1), end: dt.date | None = None) -> dict[str, Any]The whole history from start: the catalog, then market data, then fight data.
main
main() -> Nonerefresh_card
refresh_card(db: DBClient, p: Providers, day: dt.date) -> dict[str, Any]One card’s listings (Cito’s card, Kalshi’s fights and new markets, the venues’ open fights) and its readiness check: the gaps, the due ones to alert on.
refresh_card_odds
refresh_card_odds(db: DBClient, p: Providers, day: dt.date) -> dict[str, Any]One card’s books as they stand now (the card run, before the first fight): Cito’s books and BestFightOdds’ card and
fighter pages for the card, landed on the odds tables - so the card’s book block is its lines’ close as the training
rows have it (features.book: each book’s last line before the card started), not the pre-card update’s.
update_all
update_all(db: DBClient, p: Providers, days_back: int = 14) -> dict[str, Any]The recent past and the cards ahead: new cards and results, markets, trades, minutes, rounds, odds, rankings, judges’ scores.
wikipedia_venues
wikipedia_venues(catalog: CatalogFeed, registry_db: DBClient | None = None) -> Report | NoneEvery card’s venue from Wikipedia’s ‘List of UFC events’ (CatalogFeed.from_wikipedia),
under the catalog’s lock: a build reads prod’s latest snapshot (registry_db: the legacy
store), an update the page itself (the legacy consumer’s paced fetch). None: no list.