betting_combat.feeds.bfo
bfo.py — the BestFightOdds feed: every UFC card’s lines as BestFightOdds shows them, kept as its
pages (store: the sitemap and one gzipped page per event and per fighter), landed on our ids.
BfoFeed pull(store, start, end) the pages of every UFC-family card in ``start`` .. ``end`` (DWCS, Road to UFC, TUF finales included) and of every fighter on them, one request every 2 s. A page is asked again only while it can still change: a card's until a week after its day, a fighter's until it was read after his latest card in the range. A rerun asks for nothing else; a failed page is reported and asked again on the next run land(store, start, end) the stored pages onto our tables: ``odds`` (source 'bfo'): every book's line on each side and each prop of the card pages (BFO shows today's books: 2021 on). A page read after the card holds the closing lines, dated the card's start; one read before it, the lines as seen then (a row only when a price changed) ``line_paths``: each fighter's line per bout from his page: the open, the closing range across books, the path (up to 10 points, no times). His opponent's open and closing range when only the opponent's page has the fight (no path then). A row read before the card holds the line so far (``read_at``) pull_archive(store, start, end) the web archive's copy of each card's page before 2021 (today's pages show no book's line for those): the earliest copy taken after the card that shows lines (its closing lines), else the latest within a month before it (the lines as seen then). A card is asked again only after ``ARCHIVE_RETRY_DAYS`` build(store, start, end) pull (and the archive), then land; ``update`` the same over the recent past and the cards aheadA card before 2021 lands from its archived copy (the books of the time and every prop) wherever today’s page shows no line; never over a line today’s page has.
A card is BFO’s when its day is within a day of one of ours (BFO dates a card by its own clock:
UFC 302 of 2024-06-01 is its 2024-06-02) and its page names a UFC-family event. A fight lands on
the bout our matcher finds (the card’s day ± 1, both names); a card BFO lists twice (UFC 330)
lands once, from the page with more lines. Every fight it cannot place is missed.
Classes
BfoFeed
Bases: Feed
BestFightOdds’ pages of our cards, through the catalog’s ids.
build
build(store: Path, start: dt.date = dt.date(2007, 1, 1), end: dt.date | None = None) -> dict[str, Any]Every card from start (BFO’s first UFC card is 2007’s UFC 72) to the cards ahead.
cards
cards(listed: list[Listed], start: dt.date, end: dt.date) -> list[Listed]The listed events that are our cards in start .. end.
land
land(store: Path, start: dt.date, end: dt.date) -> dict[str, Any]The stored pages of our cards in start .. end onto odds and line_paths.
load
load() -> Idspull
pull(store: Path, start: dt.date, end: dt.date) -> dict[str, Any]The pages of our cards in start .. end and of their fighters (module doc).
pull_archive
pull_archive(store: Path, start: dt.date, end: dt.date) -> dict[str, Any]The archived copy of each card’s page before 2021 (module doc).
update
update(store: Path, days_back: int = 14) -> dict[str, Any]The recent past and the cards ahead.
Functions
market
market(prop: int | None, label: str) -> tuple[str, float | None]A line’s market and point: the round a round prop names, the rounds of an over/under.