Quickstart
Load a day of prediction-market trades or order books with the PredBooks SDKs for Go, Python, Rust and TypeScript.
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.
PredBooks data is a set of Parquet files: one per venue, channel and day (or hour, for order books). The SDKs for Go, Python, Rust and TypeScript find the files, download them and hand you a table. Pick your language on any code block below; the choice sticks across the docs.
Install and connect
Pick a plan on Pricing and create an API key, then install the SDK:
go get predbooks.com/gopip install "predbooks[pandas]"cargo add predbooksnpm install @predbooks/sdkimport "predbooks.com/go"
ctx := context.Background()
pb := predbooks.New(predbooks.WithAPIKey("pb_...")) // or set PREDBOOKS_API_KEYfrom predbooks import Client
pb = Client("pb_...") # or set PREDBOOKS_API_KEYuse predbooks::{Client, LoadOptions};
// or Client::new()? with PREDBOOKS_API_KEY set
let pb = Client::builder().api_key("pb_...").build()?;import { Client } from "@predbooks/sdk";
const pb = new Client("pb_..."); // or set PREDBOOKS_API_KEYSee what exists
venues, err := pb.Venues(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Println(venues["kalshi"]["trades"].LastDate)
files, err := pb.Files(ctx, "polymarket", "book_10", "2026-12-05", "2026-12-05")
// one entry per hour, with size, rows and quality flagspb.venues()
# {"kalshi": {"trades": {"first_date": "...", "last_date": "...",
# "granularity": "day", ...}, ...}, ...}
pb.files("polymarket", "book_10",
start="2026-12-05", end="2026-12-05")
# one entry per hour, with size, rows and quality flagslet venues = pb.venues()?;
println!("{}", venues["kalshi"]["trades"].last_date);
let files = pb.files("polymarket", "book_10", Some("2026-12-05"), Some("2026-12-05"))?;
// one entry per hour, with size, rows and quality flagsconst venues = await pb.venues();
// { kalshi: { trades: { first_date: "...", last_date: "...",
// granularity: "day", ... }, ... }, ... }
const files = await pb.files("polymarket", "book_10", {
start: "2026-12-05",
end: "2026-12-05",
});
// one entry per hour, with size, rows and quality flagsLoad a day
trades, err := pb.Load(ctx, "kalshi", "trades", "2026-12-05", nil)
if err != nil {
log.Fatal(err)
}
defer trades.Release()
fmt.Println(trades.NumRows(), "rows")trades = pb.load("kalshi", "trades", "2026-12-05")let trades = pb.load("kalshi", "trades", "2026-12-05", LoadOptions::new())?;
println!("{} rows", trades.num_rows());const trades = await pb.load("kalshi", "trades", "2026-12-05");
console.log(trades.numRows);trades holds one row per trade. In Python it is a pandas DataFrame (or Polars or Arrow with output=); in TypeScript and Go it is an Arrow table, and in Rust a table of Arrow record batches. Its columns are venue, market_id, event_id, outcome, instrument_id, exch_ts, recv_ts, seq, trade_id, price, size, side, mirrored and source.
Load one market's order book
Book files are large: a busy hour of Polymarket's top-10 book is about 200 MB. Pass instruments and the SDK reads only the parts of each file that hold those instruments. One market typically costs a few MB.
markets, err := pb.Markets(ctx, "polymarket", &predbooks.MarketsOptions{Q: "bitcoin"})
if err != nil {
log.Fatal(err)
}
token := markets[0].InstrumentIDs[0]
book, err := pb.Load(ctx, "polymarket", "book_10", "2026-12-05", &predbooks.LoadOptions{
Hours: []int{14, 15},
Instruments: []string{token},
})
if err != nil {
log.Fatal(err)
}
defer book.Release()market = pb.markets("polymarket", q="bitcoin")[0]
token = market["instrument_ids"][0]
book = pb.load("polymarket", "book_10", "2026-12-05",
hours=[14, 15], instruments=[token])let markets = pb.markets("polymarket", Some("bitcoin"), None, None)?;
let token = markets[0].instrument_ids[0].clone().unwrap();
let book = pb.load(
"polymarket",
"book_10",
"2026-12-05",
LoadOptions::new().hours([14, 15]).instruments([token]),
)?;const [market] = await pb.markets("polymarket", { q: "bitcoin" });
const token = market.instrument_ids![0];
const book = await pb.load("polymarket", "book_10", "2026-12-05", {
hours: [14, 15],
instruments: [token],
});Next
- References for the Go SDK, Python SDK, Rust SDK and TypeScript SDK: every option of
load, caching, output formats and errors. - API: use the data from any other language.
- Schemas: channels and columns.
- Data quality: flags, gaps and how to check them.