Skip to content

betting_combat.trading.desks

The Kalshi desk: its books in each proposition’s terms, recent volume, the settlement of a market, and (with credentials) its live executor.

The session asks the desk for quotes at a decision point; nothing above this module knows how the venue lays out its markets.

Classes

Desk

Bases: Protocol

book

book(listing: Listing, max_age_s: float) -> BookTop | None

mirror

mirror(listings: Sequence[Listing]) -> dict[str, dict[str, object]]

The books the desk already holds (no request), by role, for the recording.

prints

prints(market_id: str, since: dt.datetime, until: dt.datetime) -> list[Print] | None

The market’s trades in (since, until]; None when the venue cannot say.

quotes

quotes(listings: Sequence[Listing], now: dt.datetime, max_age_s: float, since: dt.datetime) -> dict[Role, Quote]

settlement

settlement(market_id: str) -> Settlement | None

status

status() -> dict[str, object]

KalshiDesk

Kalshi: one YES market per proposition. Books from the WebSocket mirror (REST when it is not current); the two winner markets share their combined volume (the research’s definition of a fight’s liquidity); every other market has its own.

book

book(listing: Listing, max_age_s: float) -> BookTop | None

mirror

mirror(listings: Sequence[Listing]) -> dict[str, dict[str, object]]

prints

prints(market_id: str, since: dt.datetime, until: dt.datetime) -> list[Print] | None

The market’s trades in (since, until] (paper resting orders fill from them).

quotes

quotes(listings: Sequence[Listing], now: dt.datetime, max_age_s: float, since: dt.datetime) -> dict[Role, Quote]

settlement

settlement(market_id: str) -> Settlement | None

status

status() -> dict[str, object]

Settlement