Prediction markets API
A prediction event's volume, liquidity and open interest over time
How trading on a whole prediction event moved bucket by bucket — volume, trades, traders, and liquidity and open interest as OHLC — across all of its markets.
/api/external/prediction/prediction-event-bars/{id}What it returns
Per-bucket trading across all the markets of one event (e.g. every candidate of an election): volume bought and sold, trades, unique traders, the lifetime volume as of each bucket, and the open, high, low and close of its liquidity and open interest. Bounded by from and to (Unix seconds, both inclusive), at most 1000 buckets per request. The id is an event id from prediction-events. Per-market prices are prediction-market-bars. An unknown id is a 404.
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 -H "x-dex-data-key: $DEXDATA_API_KEY" \ "https://api.dexdata.io/api/external/prediction/prediction-event-bars/<id>?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). A window of ≤ 80 bars keeps the answer under 32 KB. |
idpath · string · required | A prediction-market event id (groups one or more markets, e.g. a multi-candidate election) — not a token mint or contract address, and not scoped to any chain this API otherwise supports. |
Response fields
A JSON response. Every field is always present; null means the value could not be established, never zero.
| Field | Type | Description |
|---|---|---|
eventId | string | The event id, as passed. |
bars | object[] | One bucket per period of the window, oldest first. |
bars[].t | number | Bucket open time, Unix seconds. |
bars[].volumeUsd | number | null | Bought plus sold across the event in this bucket, USD. |
bars[].buyVolumeUsd | number | null | |
bars[].sellVolumeUsd | number | null | |
bars[].allTimeVolumeUsd | number | null | The event's lifetime volume as of this bucket, USD. |
bars[].trades | number | null | |
bars[].uniqueTraders | number | null | |
bars[].lastActivityTimestamp | number | null | Unix seconds of the last activity inside the bucket. Null when there is none. |
bars[].liquidityUsd | object | null | Liquidity across the event over the bucket, USD: open, high, low, close. |
bars[].liquidityUsd.o | number | null | |
bars[].liquidityUsd.h | number | null | |
bars[].liquidityUsd.l | number | null | |
bars[].liquidityUsd.c | number | null | |
bars[].openInterestUsd | object | null | Open interest across the event over the bucket, USD: open, high, low, close. |
bars[].openInterestUsd.o | number | null | |
bars[].openInterestUsd.h | number | null | |
bars[].openInterestUsd.l | number | null | |
bars[].openInterestUsd.c | number | null |
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