Skip to content

betting_combat.execution.paper

paper.py — how a print fills our orders when nothing is sent (paper mode), and in the backtest’s tape replay (RoundsStrategy.simulate): ONE rule for both (Sam 2026-11-16).

match one print against what we hold (``Limits``, our side): a print where the taker BOUGHT our
side at or under our take limit is an offer we would have taken: every contract of it, at
its price. A print where the taker bought the OTHER side below our resting bid (in our
side's terms: our side sold under our bid) traded through it: our bid filled first, every
contract of the print, at our price (``through``; else a print at our price fills too, the
queue ignored)

Prices are our side’s: a print’s YES price p is our side’s p (YES) or 1 - p (NO).

Functions

match

match(limits: Limits, outcome: Side, yes_price: float, taker: Side | str | None, contracts: float, through: bool = True) -> tuple[str, float, float] | None

(leg, price, contracts) the print fills of what we hold, or None (module doc).

our_price

our_price(yes_price: float, outcome: Side) -> float