betting_combat.rounds.backtest.working
Strategy 4’s backtest under the PRODUCTION execution (2026-10-05): the decision at the market’s
bell or the feed, each bet a working order bounded by the break, no volume cap, sized and capped
as the live engine sizes (rounds.live.decision). The refit judges every model with it
(services.rounds_refit); the research’s execution (book, capacity) stays for the
parity tests only.
timing per round start (round_idx k >= 1), from the recorded tapes (``decision_grid``): feed the backtest's decision minute (``models.meta_bets.entry_time``: the clock's break, a median ~50 s after the bell, as the live feed's ~45 s) bell the market's bell rule (``market.bell``) on the bell market ('ends before round k+1'), its gate placed at the feed's anchor + 4:00 (the anchor = the tape's bell - 5:00 + ``FEED_LAG``) the decision: with ``bell_decides`` the bell when it fires before the feed (or the feed came before the real bell: held by the veto), else the feed; without, the feed, held to the bell when it came before the real bell (the veto)quote the decision's quote on the bet's side: at the feed the minute book (the candidate's own entry); at the bell the last print on our side between the bell and the fire (what the book showed at the decision; until 2026-10-11 the VWAP of the prints in the 20 s AFTER the fire — a look-ahead), else the minute book known at the fire (the bell study's proxy, within 0.3c of the minute book at the feed), else the last minute book before it; the decision pair from the minute book's two 'by decision' asks. The fill curves price every fill from this quote (their drift is measured from the decision's ask)window while the round's bell is not known, ``exec_window_seconds`` after the decision; once known (the bell fired by the end of that window), up to ``exec_window_bell_seconds`` after the decision but never past the bell + 60 s - ``break_margin_seconds`` (``trading.session._set_deadline``)fills the working order's filled share and price drift over its window, by order size, from the fill curves (``fill_curves.json``: the recorded books of 2026-10-03, limit = the decision ask + 1c; ``FillModel``: low / mid / high = hold / cmin / cont; measured at 0-30 s, past 30 s the unfilled share keeps shrinking at its 20 -> 30 s rate, or held with ``past_measured='hold'``)money per decision, in time order: the bet's want (``decision.stake``), its room (the order cap, the fight cap, the card's net loss room ``card_cap_usd + settled P&L - open stakes`` and the settled stop, as ``decision.CardState``), its instruments cheapest all-in first, each in whole contracts at its limit's worst all-in; what one leaves unfilled the next may take (the live working order does each second); the edge at the decision's own quote (``min_edge``)Classes
Execution
The portfolio’s execution settings (domain.config.PortfolioConfig) and the fill model.
of
of(portfolio: Any, fills: FillModel | None = None) -> ExecutionFillModel
The working order’s filled share and price drift (fill_curves.json).
fill
fill(kind: str, dollars: float, h: float) -> tuple[float, float](filled share, extra price per contract over the decision quote) of an order of
dollars worked h seconds on a kind market (‘rounds’, ‘distance’, ‘pair’).
Functions
bell_decision
bell_decision(t_feed: pd.Timestamp, bell_at: pd.Timestamp | None, fire: pd.Timestamp | None, ex: Execution) -> tuple[pd.Timestamp, str](the decision time, ‘bell’ / ‘feed’) of one break: with bell_decides the market’s
bell when it fires before the feed decides, or when the feed decided before the real bell
(the veto holds it); without, the feed, held to the bell only by the veto.
decision_grid
decision_grid(keys: pd.DataFrame, fights: pd.DataFrame, set4: pd.DataFrame, trades_side: pd.DataFrame) -> pd.DataFramePer round start (keys: fight_id, round_idx) x traded market x side quoted at the
feed’s decision minute: the decision at the feed and at the market’s bell (see the module
doc), one row each with GRID_COLUMNS.
decisions
decisions(events: pd.DataFrame, grid: pd.DataFrame, ex: Execution) -> pd.DataFrameThe candidate bets (round_idx >= 1) as the production execution decides them: per
event its decision time t_entry (by: ‘bell’ / ‘feed’), quote entry and all-in
cost (a bell decision at ex.bell_price’s price: the known book, or the stress
line), the pair’s leg asks and the window H (seconds).
An event the grid lacks, or whose quote at the feed differs from the grid’s, is an error.
simulate
simulate(dec: pd.DataFrame, s: Settings, ex: Execution) -> pd.DataFrameThe bets the decisions (decisions) fill: one row per instrument filled with
BET_COLUMNS (planned: the whole contracts the order was sized for; contracts:
what its window filled). See the module doc for the money; as live, no bet on the other
side of a market its fight holds.
window_seconds
window_seconds(t: pd.Timestamp, fire: pd.Timestamp | None, bell_at: pd.Timestamp | None, ex: Execution) -> floatHow long a decision at t works its bets (trading.session._set_deadline): the
feed’s window while the round’s bell is not known; once the bell fired within it, up to
the bell window but never past the bell + 60 s - the margin.