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.

GET/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>"
Parameters
ParameterDescription
resolution

query · string · required

The bucket width.min1min5min15min30hour1hour4hour12day1week1
from

query · integer · required

Window start, Unix seconds (inclusive).
to

query · integer · required

Window end, Unix seconds (inclusive). A window of ≤ 80 bars keeps the answer under 32 KB.
id

path · 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.

Response fields of A prediction event's volume, liquidity and open interest over time
FieldTypeDescription
eventIdstringThe event id, as passed.
barsobject[]One bucket per period of the window, oldest first.
bars[].tnumberBucket open time, Unix seconds.
bars[].volumeUsdnumber | nullBought plus sold across the event in this bucket, USD.
bars[].buyVolumeUsdnumber | null
bars[].sellVolumeUsdnumber | null
bars[].allTimeVolumeUsdnumber | nullThe event's lifetime volume as of this bucket, USD.
bars[].tradesnumber | null
bars[].uniqueTradersnumber | null
bars[].lastActivityTimestampnumber | nullUnix seconds of the last activity inside the bucket. Null when there is none.
bars[].liquidityUsdobject | nullLiquidity across the event over the bucket, USD: open, high, low, close.
bars[].liquidityUsd.onumber | null
bars[].liquidityUsd.hnumber | null
bars[].liquidityUsd.lnumber | null
bars[].liquidityUsd.cnumber | null
bars[].openInterestUsdobject | nullOpen interest across the event over the bucket, USD: open, high, low, close.
bars[].openInterestUsd.onumber | null
bars[].openInterestUsd.hnumber | null
bars[].openInterestUsd.lnumber | null
bars[].openInterestUsd.cnumber | 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