Use this file to discover all available pages before exploring further.
The SDK’s market-data surface is intentionally narrow. The canonical
entry is client.markets() — it returns a Page[MarketInfo]:
a list-like value carrying the items plus the server’s total count, so
you can decide whether to fetch more without a second round trip.
Every response is a typed Pydantic v2 model — you get attribute access, IDE autocomplete, and validation for free. Call .model_dump() on any model if you need a plain dict.
GraphQL’s killer feature over REST: you ask only for the fields you
need. Pass a flat Selection(...) of the per-market fields you want —
the SDK auto-injects the wrapper layer for you:
from stx import Selectionpage = client.markets( selections=Selection("market_id", "status"),)# ~1 KB per 100 markets
For list queries that return 100+ items, the narrow form is 10–30× smaller on the wire. Always pass an explicit Selection in production code.
limit caps each call. Use page.count to know when to stop:
def iter_all_markets(client, page_size=200): """Yield every MarketInfo, paged through the server. Trade off page_size against latency — 200 is a reasonable default.""" offset = 0 while True: page = client.markets( params={"input": {"limit": page_size}}, selections=Selection("market_id", "title", "status"), ) if not len(page): return yield from page offset += len(page) if offset >= (page.count or 0): returnclient = STX(region="ontario", env="staging")client.login(params={})for market in iter_all_markets(client): ...
For very large bulk pulls, use AsyncSTX with asyncio.gather to
parallelize pages — see Async.
market_settlements returns the settlement trail for a specific market.
trades_for_settlement drills into the trades that contributed to a
single settlement event: