Quickstart
This fetches one day of trades for one symbol with curl, and checks the file against the day’s
manifest. You need a Datasets API key: see Keys, plans and usage.
The last step uses jq to read one field of a JSON answer.
Set your key
Every request carries your key as a bearer token. Keep it in the environment, not in your shell history or a script.
See what exists
Coverage lists each exchange with its families, its first closed day and the day it is published through. It is never counted against your plan.
GET /coverage/OKX is that exchange in full: each closed day, and for each family and symbol
the first and last day with a file and their bytes.
Read the day's manifest
A closed day’s manifest lists its files, each with its size, row count and SHA-256. Read it before you download: it says which files exist, and it is what you verify against.
The answer is cut short here, and its numbers are examples: a real day lists every file, its instruments file, and the gaps and failed hours the day does not cover.
Fetch a file
A file’s address is its family, exchange, day and symbol. The symbol is written with - for
/, so BTC/USDT is BTC-USDT. The API answers 302 with a signed storage link, and -L
follows it.
curl does not send your key to the storage host, and the link needs none: it carries its own
signature. This request counts the file’s bytes against your plan, whole, when the redirect
is answered. Asking for the same file again counts again, so keep what you have fetched.
Verify it
Compare the file’s SHA-256 with the manifest’s. The two lines print the same 64 characters.
On macOS, shasum -a 256 stands in for sha256sum. If the two differ, the day was repaired
between your two requests: read the manifest again and fetch the file again.
Read it
The file is gzip CSV with a header line.
The first line names the columns: nine that every family begins with, then the family’s own.
trades lists them with their types. A file is several
gzip members one after another, which gzip and most readers handle: make sure yours reads
them all.
Next
- Keys, plans and usage: what counts, and what to do at the limit.
- HTTP API guide: every rule the routes share, and every refusal.
- Files: what each family’s file holds.