Skip to content

betting_combat.trading.market_data

Book tops and recent traded volume for the decision engine.

The WebSocket mirror answers when it is current; otherwise a REST snapshot is taken on the spot. Either way a book is “as of” a moment the exchange confirmed it, and a market that cannot be read is simply absent (the engine records book_missing) — a data problem can cost a trade, never cause a wrong one.

Classes

MarketData

books

books(tickers: Sequence[str], max_age_s: float) -> dict[str, BookTop]

offers

offers(ticker: str, side: str, limit: float, max_age_s: float) -> list[tuple[float, float]] | None

Every offer buying side of ticker can take at or below limit (price, contracts; cheapest first) from the WebSocket mirror when it is current; None otherwise (paper then fills on the top of the book alone).

prints

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

The market’s trades in (since, until], oldest first; None when unknown.

volume

volume(tickers: Sequence[str], since: dt.datetime, until: dt.datetime) -> float | None

Contracts traded on tickers in (since, until]; None when unknown.