betting_combat.live.blocks
blocks — a fight’s 30-second blocks and in-round rows DURING the card (Sam 2026-11-19), by the SAME feature code the training
rows come from: features.fight_ticks -> fight_blocks -> stats_simulator.break_readings -> inround_blocks’ live-feed draw ->
inround_rows.rows, run on the fight’s live readings so far (ufc.snapshots / live_rounds / live_totals as live.readings
writes them during the card, each with the moment we had it). The card run’s tick re-reads the watched fights every
every_s of the session’s time and computes their rows ONCE (in a thread: never in a rule, never on a print); the strategy
reads the rows visible at a moment (visible).
LiveBlocks prepare(db, bouts) / watch(bout_id, clock, finals) / tick(now) / refresh(bout_id) / visible(bout_id, now)A row is visible (11-19 audit: fail closed) only when ALL of:
- the feed told its block’s end on the FIGHT clock: a reading WITH counts we had shows the round past the block’s end (a round block
j: its clock at 30 (j + 1) s or more, or a later round); a stopped clock, a dead feed or a failed refresh shows no new
block (never a block “ended” with nothing in it); a break’s -2 once the round before is over (its clock at 5:00 or a
later round), its -1 once the round coming has started (a reading of it, or the clock’s told start)
- its moment passed: the block’s end on the wall clock (fight_blocks’ block_end_at, the clock’s stops in it; the round’s
last block + LATE_S as the training’s, its readings to then; a break’s -2 the bell - 30 s, its -1 the bell) + lag_s
A fight still on has no official end: its rounds are taken as full; the break before round k + 1 is computed with that round
placed at its expected bell (FightClock.expected_start) until its readings tell the real one.
replay_lag_s: a replay on the archive (its readings read after the card): a reading counts as had at its capture + this
(the card run’s poll), never by the archive’s own read.
Classes
LiveBlocks
The card’s live blocks (module doc).
compute
compute(bout_id: str, inp: FightTicksInputs) -> pd.DataFrameEvery block’s row from the fight’s readings (the feature code’s live-feed draw), with moment (when the row is
had: its end + the lag) and told (the feed told its end on the fight clock): module doc.
prepare
prepare(db: DBClient, bouts: list[str], **kw: Any) -> LiveBlocksread
read(bout_id: str, until: dt.datetime | None = None) -> FightTicksInputsThe fight’s raw readings; until: only those we had by then (received_at; a replay: the capture +
replay_lag_s) - never one we did not have.
refresh
refresh(bout_id: str) -> pd.DataFrametick
tick(now: dt.datetime) -> NoneOn the session’s tick: each watched fight re-read once every_s of the session’s time has passed (a replay’s
clock as a live one); a fight over after_s ago no more. A failed refresh keeps the rows it had (nothing new is
visible from them: module doc), logged and counted.
visible
visible(bout_id: str, now: dt.datetime) -> pd.DataFrameThe fight’s rows had as of now (module doc): told on the fight clock and their moment passed.
watch
watch(bout_id: str, clock: FightClock, finals: pd.DataFrame) -> NoneRe-read the fight on every tick; finals its round-start rows so far (the typicals the rows compare against).