betting_combat.services.rounds_windows
The research’s market windows, cut by the DATASETS layer out of the full raw Kalshi data.
The raw layer (services.rounds_data) keeps every market of the six UFC series whole: every
minute candle and every trade from the market’s open to its close. The round datasets were
built on the research’s windows, so the datasets layer serves each market’s raw rows over
exactly the window the research pulled:
minute candles winner and distance: the 80 minutes to the close; side series: 90 minutes before to 5 after the fight's winner snap (``fight_snaps``; a fight without one serves none of its side markets)trades the fight's start - 60 minutes to its winner snap + 5 minutes (``rounds_inputs.design_trade_windows``, on the library's fight clock)A market seeded from the research’s own files (pull source ‘research’) is served exactly
as the research had it: its candles within the seeded span (kalshi_pulls.base_lo/base_hi),
its trades the seeded rows (kalshi_trades.source ‘research’), whatever a later pull added
around them. Windows are half-open [lo, hi); Kalshi’s candle request bounds are inclusive,
so the research’s [start, end] is [start, end + 1 s) here.
Functions
fight_key
fight_key(m: Mapping[str, Any]) -> strfight_snaps
fight_snaps(winner_markets: Sequence[Mapping[str, Any]], minutes: Mapping[str, list[dict[str, Any]]]) -> tuple[dict[str, pd.Timestamp], dict[str, str]](fight key -> the minute the winner market priced the result, fight key -> why a settled fight has none).
The snap is research ufc/props._fight_windows’ (the side series’ candles run from
90 minutes before it to 5 after), with two refusals: a fight without exactly two
settled winner markets, one of them YES, or whose book never priced the result, has
none (NO_SNAP_RESULT: a draw, a no contest); a snap on the book’s first candle is
no snap (NO_SNAP_EARLY: the result was priced before the candles begin, so the
real snap is earlier). A fight not settled yet, or whose candles are not served, is in
neither.
minute_windows
minute_windows(store: RoundsStore, tickers: Sequence[str] | None = None) -> dict[str, Window | None]ticker -> the window the datasets serve its minute candles over (None: none at all), for
every market with a minute pull (of tickers when given). A market absent from the
answer is not served (as one the research never pulled): a market pulled from Kalshi
that is not a settled YES/NO market, or a side market whose fight has no winner snap.