Prediction markets API
Many prediction markets' OHLC-style bars over a bounded window
The priced series of up to 25 prediction markets in one request, at one resolution over one bounded window, in OHLC-style bars.
/api/external/prediction/prediction-market-bars-batchWhat it returns
The prediction-market-bars answer for many markets in one request, at one resolution over one window, addressed by the ids from GET /prediction/prediction-markets. Each result is exactly what prediction-market-bars answers for that market with the same query, with the same caveats on every field. The window is capped at 1000 bars, as on the single. POST, because the list is the subject: it can run past what a URL comfortably holds, and a body keeps a watch list out of every proxy log between the caller and this service.
Chains
This endpoint is not tied to a chain: it takes no chain in its request.
Request
Send your key in the x-dex-data-key header. Replace each <placeholder> with a real value.
curl -X POST -H "x-dex-data-key: $DEXDATA_API_KEY" \
-H "content-type: application/json" \
-d '{"subjects":["<subjects>"]}' \
"https://api.dexdata.io/api/external/prediction/prediction-market-bars-batch?resolution=min1&from=<from>&to=<to>"| Parameter | Description |
|---|---|
resolutionquery · string · required | The bucket width.min1min5min15min30hour1hour4hour12day1week1 |
fromquery · integer · required | Window start, Unix seconds (inclusive). |
toquery · integer · required | Window end, Unix seconds (inclusive). Per market, a window of ≤ 90 bars keeps the answer under 32 KB; a batch keeps markets × bars ≤ 80. |
subjectsbody · string[] · optional | Prediction market ids — never a token mint or contract address. markets × bars ≤ 80 keeps the answer under 32 KB. Between 1 and 25, each sent once. |
Response fields
A JSON response. Every field is always present; null means the value could not be established, never zero.
| Field | Type | Description |
|---|---|---|
results | object[] | One entry per requested subject, in the order they were sent. |
results[].subject | string | The subject exactly as it was sent. |
results[].result | object | null | What the single-subject endpoint answers for this subject. null only when error is set. |
results[].result.marketId | string | null | |
results[].result.bars | object[] | |
results[].result.bars[].t | number | null | Bucket open time, Unix seconds. |
results[].result.bars[].volumeUsd | number | null | Volume across both outcomes in this bucket, USD. |
results[].result.bars[].uniqueTraders | number | null | |
results[].result.bars[].trades | number | null | |
results[].result.bars[].allTimeVolumeUsd | number | null | Cumulative lifetime volume as of this bucket, USD. |
results[].result.bars[].outcome0 | object | null | |
results[].result.bars[].outcome0.trades | number | null | |
results[].result.bars[].outcome0.volumeUsd | number | null | |
results[].result.bars[].outcome0.priceUsd | object | null | |
results[].result.bars[].outcome0.priceUsd.o | number | null | |
results[].result.bars[].outcome0.priceUsd.h | number | null | |
results[].result.bars[].outcome0.priceUsd.l | number | null | |
results[].result.bars[].outcome0.priceUsd.c | number | null | |
results[].result.bars[].outcome1 | object | null | |
results[].result.bars[].outcome1.trades | number | null | |
results[].result.bars[].outcome1.volumeUsd | number | null | |
results[].result.bars[].outcome1.priceUsd | object | null | |
results[].result.bars[].outcome1.priceUsd.o | number | null | |
results[].result.bars[].outcome1.priceUsd.h | number | null | |
results[].result.bars[].outcome1.priceUsd.l | number | null | |
results[].result.bars[].outcome1.priceUsd.c | number | null | |
results[].error | string | null | null, or unavailable when no source could be reached for this subject — retry it. A subject nobody has data for is NOT an error: its result says so. |
Start building with DexData today
Sign in, create a key and make your first call in a minute. Free credits every month, and you only pay for calls that succeed.
Get a free API key