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.

POST/api/external/prediction/prediction-market-bars-batch

What 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>"
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). Per market, a window of ≤ 90 bars keeps the answer under 32 KB; a batch keeps markets × bars ≤ 80.
subjects

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

Response fields of Many prediction markets' OHLC-style bars over a bounded window
FieldTypeDescription
resultsobject[]One entry per requested subject, in the order they were sent.
results[].subjectstringThe subject exactly as it was sent.
results[].resultobject | nullWhat the single-subject endpoint answers for this subject. null only when error is set.
results[].result.marketIdstring | null
results[].result.barsobject[]
results[].result.bars[].tnumber | nullBucket open time, Unix seconds.
results[].result.bars[].volumeUsdnumber | nullVolume across both outcomes in this bucket, USD.
results[].result.bars[].uniqueTradersnumber | null
results[].result.bars[].tradesnumber | null
results[].result.bars[].allTimeVolumeUsdnumber | nullCumulative lifetime volume as of this bucket, USD.
results[].result.bars[].outcome0object | null
results[].result.bars[].outcome0.tradesnumber | null
results[].result.bars[].outcome0.volumeUsdnumber | null
results[].result.bars[].outcome0.priceUsdobject | null
results[].result.bars[].outcome0.priceUsd.onumber | null
results[].result.bars[].outcome0.priceUsd.hnumber | null
results[].result.bars[].outcome0.priceUsd.lnumber | null
results[].result.bars[].outcome0.priceUsd.cnumber | null
results[].result.bars[].outcome1object | null
results[].result.bars[].outcome1.tradesnumber | null
results[].result.bars[].outcome1.volumeUsdnumber | null
results[].result.bars[].outcome1.priceUsdobject | null
results[].result.bars[].outcome1.priceUsd.onumber | null
results[].result.bars[].outcome1.priceUsd.hnumber | null
results[].result.bars[].outcome1.priceUsd.lnumber | null
results[].result.bars[].outcome1.priceUsd.cnumber | null
results[].errorstring | nullnull, 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