Python SDK
Reference for the predbooks Python package: load, download, files, markets, caching and output formats.
API key. Pick a plan on Pricing and create a key, then install the SDK for your language: the Go SDK, Python SDK, Rust SDK or TypeScript SDK.
from predbooks import Client
pb = Client(api_key="pb_...", cache_dir=None)The key can also come from PREDBOOKS_API_KEY. Downloaded files are cached in ~/.cache/predbooks (or PREDBOOKS_CACHE). The cache is keyed by each file's version, so a file that was reprocessed is fetched again.
load
pb.load(venue, channel, date, hours=None, instruments=None, columns=None,
output="pandas", decimals="float")| Argument | Meaning |
|---|---|
venue, channel, date | For example "polymarket", "quotes", "2026-12-05" (UTC days) |
hours | For hourly channels (book_delta, book_10, quotes): which hours, for example [13, 14]; default all |
instruments | Only these instrument ids. Read with HTTP range requests instead of downloading whole files |
columns | Only these columns |
output | "pandas", "polars" (needs predbooks[polars]) or "arrow" |
decimals | "float" (default) turns prices and sizes into float64; "exact" keeps the stored decimals |
Prices and sizes are stored as exact decimals. Converting decimals to Python objects is slow, so the default gives you float64. Ask for decimals="exact" when you need every digit: pandas then holds decimal.Decimal values, and Arrow and Polars keep the decimal type.
Other calls
| Call | Returns |
|---|---|
pb.venues() | Venues, their channels, first and last dates, sizes |
pb.files(venue, channel, start=None, end=None) | Files with date, hour, size, rows, version and flags |
pb.markets(venue, q=None, date=None, limit=50) | Markets matching a question search or an exact market id, with their instrument_ids |
pb.download(venue, channel, date, hour=None) | Path to the downloaded (or cached) Parquet file |
pb.link(venue, channel, date, hour=None) | A signed download URL, valid for an hour |
pb.me() | Your plan and files used |
Errors raise predbooks.PredBooksError with status, code and message.
Free data
markets and coverage need no key:
pb = Client()
pb.load("kalshi", "markets", "2026-12-05")