Skip to content

betting_combat.services.markets

Today’s card straight from Kalshi: its fights, their markets and milestones.

Used by the card run (trading.session) and strategy 4’s upcoming-card loader (services.rounds_upcoming) — trading never waits on a batch job.

Classes

CardMarkets

Functions

card_markets

card_markets(kalshi: KalshiRest, card_date: dt.date) -> CardMarkets

discover_card’s reads, also returning every market ticker it saw.

derive_fights

derive_fights(winner_markets: Iterable[Market], distance_markets: Iterable[Market], side_markets: Iterable[Market] = (), milestones: Iterable[Milestone] = (), competitions: dict[str, str | None] | None = None, known: dict[str, Fight] | None = None) -> tuple[list[Fight], Counter[str]]

One Fight per winner event with exactly two markets.

Values Kalshi does not supply this time (a milestone gone from the feed, an event label not re-read) keep what known already had; nothing known is ever overwritten with nothing.

discover_card

discover_card(kalshi: KalshiRest, card_date: dt.date) -> tuple[list[Fight], Counter[str]]

Today’s card straight from Kalshi: the fights whose winner events carry the card’s date code, their distance and decision side markets, milestones and card label.

fight_status

fight_status(a: Market, b: Market) -> tuple[str, str | None]

(status, winner) from the two winner markets’ official results.

side_roles

side_roles(a: Market, b: Market, side_markets: Iterable[Market], problems: Counter[str]) -> tuple[tuple[Role, str], ...]

The fight’s side markets, as (role, ticker): each fighter’s method-of-victory markets (matched to A/B by Kalshi’s competitor id, else by name) and the draw one, the method-of-finish markets, the victory-round markets (each fighter’s rounds by name, and decision / draw / no contest) and “ends before round k”. The two “by decision” markets are only kept together (the decision pair buys them together).