betting_combat.execution.venues
venues.py — the venues the execution sends to, behind one face (Sam 2026-11-16: Kalshi and Polymarket US).
Venue quote (our side's top from the card's live book mirror, our own resting order left out), cash, buy (a limit order: IOC to take, GTC post-only to rest), amend, cancel, look (an order's state), fills (an order's fills, the venue's record), feeKalshiVenue the Kalshi client (``providers.kalshi``) and the recorder's Kalshi books (``BookMirror``); NO is bought as NO (its own price)PolyUsVenue the Polymarket US client and the recorder's US books (each frame a whole book in the long side's terms); our side is the venue's long or short as the market's ``venue_side`` says; its fills are the order's cumulative fills (no fill list)Every send is once (never retried: a lost answer is looked up, look). Prices are our side’s, 0-1,
on the venue’s 1c tick.
Classes
Ack
An order’s state on the venue.
KalshiVenue
Bases: Venue
amend
amend(market: Market, outcome: Side, ack: Ack, price: float, count: float, client_order_id: str) -> Ackbuy
buy(market: Market, outcome: Side, price: float, count: float, resting: bool, client_order_id: str) -> Ackcancel
cancel(market: Market, ack: Ack) -> Nonecancel_open
cancel_open(markets: list[Market], prefix: str) -> intcash
cash() -> floatfills
fills(market: Market, outcome: Side, ack: Ack) -> list[VenueFill]find
find(market: Market, client_order_id: str, since: dt.datetime) -> Ack | Nonelevels
levels(market: Market, outcome: Side) -> tuple[list[tuple[float, float]], list[tuple[float, float]]] | Nonelook
look(market: Market, ack: Ack) -> Ackready
ready() -> str | NoneKalshi takes no sports order once our key’s location attestation has expired.
PolyUsVenue
Bases: Venue
amend
amend(market: Market, outcome: Side, ack: Ack, price: float, count: float, client_order_id: str) -> Ackbuy
buy(market: Market, outcome: Side, price: float, count: float, resting: bool, client_order_id: str) -> Ackcancel
cancel(market: Market, ack: Ack) -> Nonecancel_open
cancel_open(markets: list[Market], prefix: str) -> intEvery open order on the card’s markets (the US account is the execution’s alone).
cash
cash() -> floatfills
fills(market: Market, outcome: Side, ack: Ack) -> list[VenueFill]The order’s fills so far as one row per change of its cumulative fill (the US gives no fill list): the newest cumulative fill at its average price, the fee computed.
find
find(market: Market, client_order_id: str, since: dt.datetime) -> Ack | Nonelevels
levels(market: Market, outcome: Side) -> tuple[list[tuple[float, float]], list[tuple[float, float]]] | Nonelook
look(market: Market, ack: Ack) -> Ackready
ready() -> str | NoneVenue
One venue’s face (module doc).
affordable
affordable(cash: float, price: float) -> intWhole contracts cash buys at price with the taker fee.
amend
amend(market: Market, outcome: Side, ack: Ack, price: float, count: float, client_order_id: str) -> Ackbuy
buy(market: Market, outcome: Side, price: float, count: float, resting: bool, client_order_id: str) -> Ackcancel
cancel(market: Market, ack: Ack) -> Nonecancel_open
cancel_open(markets: list[Market], prefix: str) -> intEvery order of ours still resting on markets (ids starting prefix) cancelled: a relaunched card run
starts clean, never with an earlier run’s bid left on the book. How many.
cash
cash() -> floatfee
fee(price: float, contracts: float) -> floatThe taker fee of contracts at price, rounded up to the cent (the venues charge it so).
fills
fills(market: Market, outcome: Side, ack: Ack) -> list[VenueFill]find
find(market: Market, client_order_id: str, since: dt.datetime) -> Ack | NoneA sent order whose answer was lost, by our id (None: the venue has none).
levels
levels(market: Market, outcome: Side) -> tuple[list[tuple[float, float]], list[tuple[float, float]]] | NoneOur side’s bids (best first) and offers (cheapest first), (price, size); None when the book is not mirrored.
look
look(market: Market, ack: Ack) -> Ackquote
quote(market: Market, outcome: Side, mine: tuple[float, float] | None = None) -> Quote | NoneOur side’s top: the best bid others hold (mine = our resting (price, contracts) left out) and the best offer.
ready
ready() -> str | NoneWhy live orders cannot go out now (None: they can).
VenueFill
Functions
floor_tick
floor_tick(p: float) -> float