betting_combat.features.full_blocks
full_blocks — THE FULL BLOCK TABLE (Sam 2026-11-19): every row of a fight at every level it changes, every feature, so any
formulation is a pick and a join. Each level holds what changes at it, stored once; read repeats the levels above onto
the rows asked for (the fight’s on every round and block row of it, the round’s on every block row of it).
level key what changes there (its columns)fight bout_id the pre-fight row (round 1's start): the fight and the event, both fighters - history, profile, career, matchups (x_), the books, the markets before the fight (features.final's hist_ prof_ x_ book_ mkt_, its fight_ as event_), the fighters' ids, scheduled roundsround bout_id, round each round's start (its bell; round r = features.final's brk r - 1): the coming round's typicals (up_), the fight so far and the round before as the official totals had them at the bell (sofar_, prev_), rounds done / left; our price level at the bell (features.prices as bell_*, and the strategy's x / pf / last / lv_winner / lv_distance / lopsided)block draw, bout_id, round, block every 30-second block end of the fight - the break's two (-2, -1) and the round's (0 ..) - as the live feed showed it (features.inround_rows: blk_, blk3_, rnd_, prevrd_, fight_, mom_, vs_typ / vs_opp, d_ / lr_, the judges' lines, time_, feed_): draws 1-5 SIMULATED (every fight on the cards we trade since 2015)live bout_id, round, block the same block features from Cito's REAL feed (draw 0, the fights it read), every name live_*: extra columns on the block rowsmarket bout_id, round, block the venues' REAL quotes and prints at each block's end (features. market_blocks): kalshi_* / poly_* / polyus_* x winner (A) / distance / finish_round (ends before the next round) / ko x bid, ask, mid, spread, last, vwap, trades, contracts, yes_taker, no_taker, quote_changes, quote_agesimpx draw, bout_id, round, block the SIMULATED quotes of draws 1-5 (models.block_price_simulator, built from the outcome): the rule's backtest only - NEVER a model input (GUARD)round_simq bout_id, round the price simulator's simulated bell quotes (features.prices' *_sim_*, *_ask_pct, *_ask_gap_sim: drawn with the outcome) - NEVER an inputThe round level’s real quotes AT the round’s start (bell_kalshi_* / bell_poly_* / bell_polyus_* and their gaps) are after
a break row’s moment: read blanks them on the break’s rows (-2, -1).
labels bout_id, round, block what happened after each block (features.inround_labels): apart, never
in a row’s inputs
Every column is stored as it is. dictionary lists every column: level, family, filled share, as of when. The market level
carries each venue’s movements per block (market_features).
Storage: parquet under root (a level a file; the block level a file a draw): the disk would not hold the pre-fight
columns copied onto every block row (~18 GB), nor Postgres a table this wide (1,600 columns).
FullBlocks build(db) / read(...) / dictionary() / aliases()Classes
FullBlocks
The full block table (module doc).
aliases
aliases() -> dict[str, str]None: every column is stored as it is (kept for a read’s interface).
build
build(db: DBClient, say: Any = log.info) -> dict[str, Any]Every level from the feature tables (module doc); exact copies found on the first simulated draw and stored once; the dictionary written.
path
path(level: str, draw: int | None = None) -> PathA level’s file (the block and simpx levels: one a draw).
read
read(rows: str = 'block', draws: tuple[int, ...] | None = None, columns: list[str] | None = None, fight: bool = True, round_: bool = True, live: bool = False, market: bool = False, labels: bool = False) -> pd.DataFrameThe rows of one level (rows: ‘fight’ | ‘round’ | ‘block’; draws the simulated draws of the block rows), with
the levels above repeated onto them (fight, round_) and the real extras (live, market: their block
rows’ keys) and labels; columns: names or prefixes to keep (every level’s; an alias answers its copy).
write_dictionary
write_dictionary() -> pd.DataFrameEvery stored column: level, family (its prefix), dtype, filled share (on the level’s rows; the block level on its first draw).
Functions
market_columns
market_columns(mb: pd.DataFrame, bouts: pd.DataFrame) -> pd.DataFrameThe venues’ real block quotes and prints (module doc), one row per (bout_id, round, block); a winner market in fighter A’s terms (A’s own, else 1 - B’s).
market_features
market_features(W: pd.DataFrame, level: pd.DataFrame, dates: pd.Series) -> pd.DataFrameThe venues’ real block quotes (market_columns) with their movements, each as of the block’s end (Sam 11-19), per
venue x market prefix p (kalshi_ / poly_ / polyus_ x winner / distance / finish_round / ko): the price (the mid; Polymarket
intl, no book: its last) and
p_chg_blk / p_chg_3 its change since the block before / three blocks before (the fight’s blocks in order: each
round’s break -2, -1, then its blocks)
p_chg_bell since the last bell (a round’s block: its bell, the -1’s end; a break’s block: the round
before’s bell)
p_chg_fight since the fight’s first quoted block
p_range_rnd the round’s (its break’s) high less low so far; p_vol3 the spread of its last three changes
p_flow / p_flow_cum_rnd YES takers less NO takers over all takers in the block / their difference summed over the round
p_contracts_cum_rnd contracts traded in the round so far
p_spread_vs_fight the spread less the fight’s median spread so far
p_spread_vs_typ the spread less the typical spread of that market at that block of a round on EARLIER cards
(the median of each earlier card’s median - never the card’s own or a later one)
p_vs_level the price less our level at the round’s bell for that market (level: the round level’s
bell_*q50 / pf: winner A’s, distance YES, finish_round = pf, ko = 1 - no-KO)
gap_kalshi_poly{m} Kalshi’s price less Polymarket’s
Real quotes only (the simulated ones built from the outcome are never inputs: simpx).