Skip to content

betting_combat.services.rounds_seed

Seed the rounds store from the research’s own raw files (data/ufc/raw or the frozen data/ufc/parity/rounds/inputs), through the same row builders the daily flow uses.

This is how the known-answer tests put the research’s inputs into a store; it is also a one-off backfill tool (the judge scores and card segments took hours of polite scraping, and the research’s trade tapes cover the windows the models were fitted on). It is not a job: nothing runs it unless Sam does.

raw/ufcstats_<file>.csv -> the mirror snapshot (+ fighter ids)
raw/wiki_ufc_events.json -> wiki_event_lists
raw/card_segments.csv -> card_segments
raw/judge_scores.csv -> judge_scores (position = the research's row order)
raw/kalshi_markets.json, kalshi_distance_markets.json, props_<series>_markets.json
-> kalshi_series_markets (list order = the file's)
raw/kalshi_minute_candles.json, kalshi_distance_minutes.json, props_<series>_minutes.json
-> kalshi_series_minutes (+ pull records: the seeded span)
raw/mm/<ticker>.json.gz -> kalshi_trades ('research:<ms>:<n>' ids) + pull
records with the tape's own window
raw/ufc-master.csv, fights_sportsbook.csv
-> rounds_static_files (verbatim, with SHA-256)
fights_kalshi.csv -> fights_kalshi (each row's cells verbatim)
raw/kalshi_candles.json -> kalshi_hourly_candles (the research's hourly candles)

Functions

markets_file

markets_file(raw: Path, series: str) -> Path

minutes_file

minutes_file(raw: Path, series: str) -> Path

seed_card_segments

seed_card_segments(store: RoundsStore, raw: Path, at: dt.datetime) -> int

seed_event_list

seed_event_list(service: RoundsDataService, raw: Path, at: dt.datetime) -> int

seed_fights_kalshi

seed_fights_kalshi(store: RoundsStore, path: Path, at: dt.datetime) -> int

The research’s fights_kalshi.csv, every row’s cells verbatim (a stored row is kept).

seed_hourly_candles

seed_hourly_candles(store: RoundsStore, path: Path, at: dt.datetime, tickers: Iterable[str] | None = None) -> int

The research’s hourly winner candles (raw/kalshi_candles.json: ticker -> the API’s candlesticks), all or only tickers; no window recorded (the research’s was the 48 hours to the close).

seed_judge_scores

seed_judge_scores(store: RoundsStore, raw: Path, at: dt.datetime) -> int

seed_kalshi_markets

seed_kalshi_markets(store: RoundsStore, raw: Path) -> int

seed_kalshi_minutes

seed_kalshi_minutes(store: RoundsStore, raw: Path, at: dt.datetime, tickers: Iterable[str] | None = None) -> Counter[str]

Minute candles of every series (only tickers when given). Returns rows per series.

seed_kalshi_trades

seed_kalshi_trades(store: RoundsStore, raw: Path, tickers: Iterable[str], at: dt.datetime) -> int

The research tapes of tickers (a ticker without a tape file is skipped).

seed_static_file

seed_static_file(store: RoundsStore, name: str, path: Path, at: dt.datetime) -> int

One static research file verbatim (ufc_master: raw/ufc-master.csv; fights_sportsbook: fights_sportsbook.csv). The text must be UTF-8 and read back by pd.read_csv to the file’s own rows.

seed_ufcstats

seed_ufcstats(service: RoundsDataService, raw: Path) -> int

tape_rows

tape_rows(ticker: str, trades: list[list[Any]]) -> list[dict[str, Any]]

A research tape ([ts_ms, yes_price, count, taker_yes, block] rows) as trade rows; the research kept no trade ids, so each is research:<ms>:<n-th at that ms>.