Official Python and TypeScript clients.
SDKs
Typed SDKs are on the roadmap. Until then, use the REST API with requests (Python) or fetch (TypeScript). Every data and backtest page ships a ready-to-run example.
Python (requests)
pip install requests
import os
import requests
API = "https://api.aymardata.com/v1"
H = {
"Authorization": f"Bearer {os.environ['AYMARDATA_API_KEY']}",
"User-Agent": "aymardata-docs/1.0",
}
book = requests.get(
f"{API}/book",
headers=H,
params={
"source": "polymarket",
"market": "btc-updown-15m",
"outcome": "up",
"at": "2026-10-22T14:30:00Z",
"depth": 6,
},
timeout=30,
).json()
trades = requests.get(
f"{API}/trades",
headers=H,
params={
"source": "polymarket",
"market": "btc-updown-15m",
"outcome": "up",
"start": "2026-10-22T14:00:00Z",
"end": "2026-10-22T15:00:00Z",
"limit": 200,
},
timeout=30,
).json()["data"]
print(book["spread"], len(trades))
TypeScript (fetch)
const API = "https://api.aymardata.com/v1";
const headers = {
Authorization: `Bearer ${process.env.AYMARDATA_API_KEY}`,
"User-Agent": "aymardata-docs/1.0",
};
const qs = new URLSearchParams({
source: "polymarket",
market: "btc-updown-15m",
outcome: "up",
at: "2026-10-22T14:30:00Z",
depth: "6",
});
const book = await fetch(`${API}/book?${qs}`, { headers }).then((r) => r.json());
console.log(book.spread);
Retry idempotent GETs on 429/5xx with exponential backoff.