Skip to content

betting_combat.trading.rounds_joint

Strategy 4’s JOINT execution inside the card run (domain.config.RoundsConfig.execution ‘joint’, 2026-10-13): the pieces trading.rounds.RoundsRunner uses to turn one decision into working orders. The decision itself is rounds.live.joint.rebalance — the backtests’ (rounds.backtest.joint) to the line.

holdings the fight's position from the run's own filled orders in its mode
(``joint.holdings_from_fills``): a sell is a buy of the other side (Kalshi nets
YES against NO); a live order of unknown fate stops the fight's decisions
rule the strategy row's Kelly, caps and min edge, the portfolio's sizing bankroll,
the production shade at round_idx 1, sells at the breaks or not
card cap the card's loss room for this fight (``card_cap_usd`` + the card's settled P&L
- every other fight's unsettled stakes - their working rooms) bounds the
fight's loss in every state after the trades (``joint.loss_rows``): the cap is
a bound on what the card can lose, as ``CardState`` (Sam, 2026-10-04)
orders one working order per trade (``trading.working``): a buy keeps buying at up
to the decision's quote + the cushion (never above the price that still clears
the min edge) until its contracts are filled or the window closes; a sell buys
the other side up to its contracts, never below the decision's bid less the
cushion; a pair both legs, the second caught up to the first
in-round ``MidPlan``: after a joint break with the market's bell, every minute end of
the round that follows (from the round's start + 60 s, while tau < 5:00, the
next round's bell has not fired and its break is not decided, the winner books
leave the fight open) decides again on the clock-updated probabilities, with
one take-now slice (IOC) per order

Classes

MidPlan

One fight’s in-round decisions after its joint break round_idx (the round after it, round_idx + 1): the break’s probabilities (A, B, Cw, Cd), the candidate instruments it may buy, the round’s start (the market’s bell of round round_idx + 60 s), fighter A’s share of the decision wins (the pair legs’ chances) and the break’s decision.

minute

minute(at: dt.datetime, interval_s: int = 60) -> tuple[int, float] | None

The in-round decision at makes (its index: whole interval_s periods since the round’s start; tau seconds), or None when it is outside the round’s decisions (before the first minute end, or past 5:00). interval_s 60: one a minute end.

Functions

fight_fills

fight_fills(orders: Iterable[OrderRecord], fight_id: str, mode: str, name_of: Mapping[str, str], strategy: str = 'rounds') -> list[Fill]

The strategy’s filled orders of the fight in this mode as joint.Fill (name_of: Kalshi ticker -> the dataset’s A-framed market name; a market it does not name is left out).

gated_buys

gated_buys(cands: Sequence[Candidate], metas: Sequence[float | None], sizing_rule: str) -> tuple[str, ...]

The candidates’ instruments the sizing rule lets the rebalance buy, in the candidates’ order: every one under ‘kelly’ (the primary alone), the meta probability at least one half under ‘kelly_meta_filter’ (none: not bought).

holdings

holdings(orders: Iterable[OrderRecord], fight_id: str, mode: str, name_of: Mapping[str, str], round_idx: int, strategy: str = 'rounds') -> Holdings

The strategy’s position in the fight (each strategy holds and sizes its own).

joint_rule

joint_rule(s: Settings, shade: float) -> JointRule

The joint rule of the decision’s settings.

leg_specs

leg_specs(inst: str, kind: str, round_idx: int, books: Mapping[str, Any]) -> list[tuple[str, Literal['yes', 'no'], float]] | None

The Kalshi orders of one trade: (A-framed market, the side bought, the price that side shows now) per leg; None when a book is missing. A sell buys the other side.

order_unknown

order_unknown(orders: Iterable[OrderRecord], fight_id: str, mode: str, strategy: str = 'rounds') -> bool

A live order of the fight whose fate is not known: still ‘submitted’ (its answer and its lookup both lost). An ‘error’ order was looked up on the venue and not found (the card run looks again before each decision, CardSession._reconcile_fight): it holds nothing.

other_risk

other_risk(orders: Iterable[OrderRecord], settlements: Mapping[str, SettlementRecord], fight_id: str, mode: str, strategy: str = 'rounds') -> float

What the strategy’s OTHER fights of the card still have at stake in this mode: their filled orders not settled yet, at cost (a live order of unknown fate at its limit).

own_dollars

own_dollars(orders: Iterable[OrderRecord], fight_id: str, name_of: Mapping[str, str], since: dt.datetime, until: dt.datetime) -> dict[str, float]

The fight’s own LIVE fills in (since, until] as the tape counts them (contracts x the YES price), per market: the in-round volume cap leaves them out — the backtest’s minute volumes never held our trades. orders: every strategy’s (one Kalshi account: the other run’s fills are ours too). Paper fills never reach the tape.

tape_dollars

tape_dollars(trades: Iterable[tuple[str, dt.datetime, float, float]], since: dt.datetime, until: dt.datetime) -> dict[str, float]

Dollars traded per market (count x YES price) in (since, until]: the in-round volume cap’s window (the minute panel’s dvol over its last minutes).

trade_plans

trade_plans(trades: Sequence[Trade], p4: np.ndarray, share_a: float, round_idx: int, books: Mapping[str, Any], prices: Mapping[str, Price], ticker_of: Callable[[str], tuple[Role, str] | None], s: Settings, decision_id: str, fight_id: str, client_id: Callable[[str, str], str]) -> tuple[list[BetPlan], dict[str, list[dict[str, Any]]], list[str]]

The working orders of the rebalance’s trades: one BetPlan per trade (its contracts the cap), and per market (‘rounds’, ‘distance’) what the record’s leg lists as bought. A trade whose market is not listed, or whose book is gone, is left out (its name in the third list).

vol_caps

vol_caps(dollars: Mapping[str, float], round_idx: int, share: float) -> dict[str, float]

Each instrument’s in-round cap: the share of its market’s dollars (the pair: its thinner leg’s).