betting_combat.features.group_bars
group_bars — the information bars of every market group of every fight, stored (Sam 2026-11-20):
features.group_bars a row a bar of a group: the flow of all its markets, the group's price, the parts' price, the VWAP (``price_bars.make_group_bars``) key (group_id, bar_type, bar_no)features.group_bar_members a row a bar x market of the group: that market's own numbers and its two sides' last prices, carried forward key (group_id, bar_type, bar_no, market_id)features.group_flows a row a group: what it traded before the fight and in it (trades, contracts, dollars) - the history the bar sizes come from key (group_id)The groups: market_groups.group_map (winner, ko, sub, distance, rounds_k). The trades: the venue’s own (ufc.trades),
a group’s from all its markets in one stream; the trades before the fight only warm the bars up (the fight’s start and end:
the first and last block of features.market_blocks - nothing else of the clock is used). The bar size, AS OF THE BELL
(price_bars.standard_sizes): 1 / TARGET of the group’s expected in-fight flow = its type’s in-fight / pre-fight flow
on EARLIER cards (an exponential average) x its own pre-fight flow; a type’s first card has no bars. The bar types written:
TYPES (dollar and dollar-runs; every type is in the code).
build every card in date order; update the cards from a day on (the sizes from the stored flows of the cards before);
both check, group by group, that the bars’ trades, contracts and dollars are the trades’ before writing.
Where a bar is in its fight (tag), from the same rounds features.market_blocks runs on: round and round_s
(the round under way at the bar’s END and the seconds into it; in the break before a round: that round, seconds under 0),
fight_s (the fight’s seconds fought by then), clock_source (who told the round’s start). A tag only - no bar is cut
by it. CUSUM events (price_bars.cusum_events on the group’s close_mid, CUSUM): chg, vol, cusum_h, cusum_up,
cusum_down, is_event, event_no, bars_since_event on every bar.
Classes
GroupBars
The stored group bars (module doc).
build
build(db: DBClient) -> dict[str, int]check
check(gid: str, live: pd.DataFrame, B: pd.DataFrame, mm: pd.DataFrame) -> NoneThe bars’ totals are the trades’ (each bar type), the members’ too - else no write.
flows
flows(S: pd.DataFrame, g: pd.DataFrame, day: pd.Timestamp) -> pd.DataFrameEach group’s flow before the fight and in it (trades, contracts, dollars), a row a group of the card.
update
update(db: DBClient, since: dt.date) -> dict[str, int]Functions
kind_of
kind_of(group: pd.Series) -> pd.SeriesA group’s type: rounds_2, rounds_3 … are all ‘rounds’.
tag
tag(bars: pd.DataFrame, rounds: pd.DataFrame) -> pd.DataFramebars (bout_id, end_at) with where each is in its fight (module doc). rounds: a row a round of a fight - bout_id,
round, break_at (its break’s start, where its rows begin), bell_at, round_end_at, clock_source.