Prediction markets API
One prediction-market trader's results bucketed over a window
How one prediction-market trader's volume, trades, wins, losses and realized profit moved per hour, day or week, with a running profit total — a PnL curve.
/api/external/prediction/prediction-trader-bars/{id}What it returns
A trader's activity per hour, 4 hours, day or week between from (inclusive) and to (exclusive): trades, buys, sells, markets traded, volume, wins, losses, the profit realized in each bucket and its running total. Every bucket of the window is answered, a bucket with no trading as zeros with the running total carried over it. The id is a traderId from prediction-trades or prediction-market-traders rows — copy it as given. An id no trader has is a 404, never a series of zeros a caller would chart as a real trader who sat out the window. At most 1000 buckets per request.
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-trader-bars/<id>?resolution=hour1&from=<from>&to=<to>"
| Parameter | Description |
|---|---|
resolutionquery · string · required | The bucket width.hour1hour4day1week1 |
fromquery · integer · required | Window start, Unix seconds (inclusive). |
toquery · integer · required | Window end, Unix seconds (exclusive): a bucket opening at to is not answered. A window of ≤ 175 bars keeps the answer under 32 KB. |
idpath · string · required | A prediction-market trader id, e.g. "<walletAddress>:Polymarket", as traderId in prediction-trades and prediction-market-traders rows — not a bare wallet 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 |
|---|---|---|
traderId | string | The trader id, as passed. |
bars | object[] | One bucket per period of the window, oldest first. |
bars[].t | number | Bucket open time, Unix seconds. |
bars[].trades | number | null | |
bars[].buys | number | null | |
bars[].sells | number | null | |
bars[].markets | number | null | How many different markets the trader traded in the bucket. |
bars[].volumeUsd | number | null | Bought plus sold, in USD. |
bars[].buyVolumeUsd | number | null | |
bars[].sellVolumeUsd | number | null | |
bars[].wins | number | null | Results counted as won in the bucket. Not every trade is counted as a win or a loss. |
bars[].losses | number | null | Results counted as lost in the bucket. |
bars[].realizedPnlUsd | number | null | Profit realized in the bucket, in USD. Negative for a loss. |
bars[].cumulativeRealizedPnlUsd | number | null | Running total of realized profit through this bucket, in USD. |
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