betting_combat.rounds.live.round_feed
Each break’s round lines from Cito’s live feed: the rounds fought so far, per fighter, as the
primary model reads them (features.breaks.BreakStats.live). The one piece of rounds.live
that talks to the outside, through the client it is given (consumers.cito.CitoRest).
A round’s line is the research’s live line (data/ufc/cito/build/s03_compare.py, the line
breaks.LIVE_MAPS was fitted on): the last snapshot carrying the round’s line captured before
the first snapshot past the round (one in a later round; for the bout’s last round, the first
calling it completed). Lines keep changing after the bell, through the break (up to ~45 s on the
samples) and sometimes in later rounds (corrections), so each round’s line is fixed at its own
break and kept; a round whose break the feed did not see is read from the bout’s whole history
(one call).
bell_lines(fight, k), what the card run calls at round k’s bell: one look at the feed, and the
break decides on it at once, like every break. Rounds 1..k-1 are their lines fixed at their
breaks (from the same page, which reaches back past the round before’s end, or one catch-up
call); round k is the newest snapshot’s line. Below the Pro plan the feed is ~60 s late, so at
the bell that is round k as it stood about a minute before the bell (inexact); on Pro, the
round’s line. None when it cannot be had within bell_timeout_s: the break prices on
‘no_stats’.
round_lines(fight, k), called once round k has ended, polls the bout’s newest snapshots until
round k’s line is final:
next_round a snapshot past round k is in: the research's line, exactlycompleted the bout is over (a stoppage in the break): the same, before the first 'completed' snapshotsettled the feed shows round k's clock run out (the break) and the line unchanged over ``settle_polls`` polls: the newest line (the research's unless it changes again before the next round)and returns rounds 1..k oriented to our fighter A, or None (fail closed): the bout not linked, no data, the call cap or the deadline reached, or the budget refusing.
Frugal polling: Cito is ~60 s late below the Pro plan, so at the bell the feed still shows the
round’s last minute; the second poll waits out the round’s remaining clock and the break
(break_s), then polls poll_s apart; errors and unexpected states back off (x backoff
up to max_wait_s); at most max_calls feed calls per break. A bout’s first call only
starts the plan’s delayed copy (an empty ‘warming’ answer: wait retry_after_seconds), so
prime each bout when its fight starts.
Classes
FeedConfig
FeedFight
One fight as the feed serves it: fight_id stamps the lines (the round datasets’ id:
the UFCStats fight), fighter_a is the fighter whose lines are side ‘a’ (the dataset’s A:
Kalshi’s fighter B when trading.rounds.FightLink.swap), on the card of card_date.
FeedSource
Bases: CardSource, Protocol
The card listings and the bout snapshots (consumers.cito.CitoRest).
snapshots
snapshots(bout_id: str, limit: int = 20) -> SnapshotPageRoundFeed
The round lines of one card run’s fights (links and fixed lines kept for the run).
bell_lines
bell_lines(fight: FeedFight, round_no: int) -> RoundLines | NoneRounds 1..round_no at round round_no’s bell, from one look at the feed (see the
module doc); None when they cannot be had within bell_timeout_s (fail closed:
findings counts why).
link
link(fight: FeedFight) -> BoutLink | NoneThe fight’s Cito bout. The card listing is read once per card, and again when a
fight is not on it (a late change, or a card not listed yet): at once the first time,
then at most every relist_s.
prime
prime(fight: FeedFight) -> boolLink the fight and make its bout’s first feed call, which starts the plan’s delayed copy (an empty ‘warming’ answer for ~60 s): call it when the fight starts so the first break finds the feed warm. True when linked and answered.
reading
reading(fight: FeedFight, now: dt.datetime) -> tuple[str, int | None, str | None] | NoneThe fight’s state now on Cito’s live feed, as Kalshi’s feed says it: (status,
current round, winner slug) of its newest snapshot, the status in Kalshi’s words
(‘upcoming’, and ‘live’ before round 1 shows, are ‘scheduled’). For a fight Kalshi’s feed has no data provider for
(Fight.feed_linked False: it never shows it in progress). None when there is
nothing to read (not linked, no snapshot yet, warming, a failed call) or the newest
snapshot of a live fight is older than STALE_READING (a stopped feed is no
reading): never raises.
round_lines
round_lines(fight: FeedFight, round_no: int) -> RoundLines | NoneRounds 1..round_no once round round_no’s line is final (see the module doc);
None when it cannot be had (fail closed: findings counts why).
RoundLines
Round round_no’s break: lines (fight_id, side ‘a’ | ‘b’, round, FIELDS; rounds
1..round_no, side ‘a’ our fighter A) for BreakStats.live.
Functions
break_lines
break_lines(snapshots: Sequence[LiveSnapshot]) -> dict[int, Line]Every round’s line at its break (the research’s, see the module doc) among
snapshots, which must be contiguous (one page of the newest, or the whole history).
Snapshots without round stats are skipped (the research never saw them); a round whose end
is not among them (still running, or its last snapshot before the page) is left out.
fighter_lines
fighter_lines(snapshot: LiveSnapshot, round_no: int) -> Line | NoneBoth corners’ line of round round_no in one snapshot; None unless both carry the
round with all 22 stats.
in_break
in_break(snapshot: LiveSnapshot, round_no: int, round_s: float = 300.0, slack_s: float = 5.0) -> boolThe snapshot shows round round_no’s clock run out, the bout not over: the break.
orient
orient(lines: Mapping[int, Line], fight_id: str, a_corner: str) -> pd.DataFrameThe lines as BreakStats.live reads them: fight_id, side, round, FIELDS; side ‘a’ is
the a_corner fighter.