Documentation Index
Fetch the complete documentation index at: https://docs.codex.io/llms.txt
Use this file to discover all available pages before exploring further.
Prediction Market data is currently in beta. It is actively being worked on and improved, but may be unreliable. Polymarket and Kalshi data are live.
This endpoint requires a Growth or Enterprise plan. Learn more.
Returns
See OnPredictionEventBarsUpdatedResponse
Show Properties
Show Properties
The ID of the prediction event.
The bar data.
See PredictionEventResolutionBarData
Show Properties
Show Properties
Data for the 1-minute resolution.
See PredictionEventBar
Show Properties
Show Properties
The unix timestamp for this bar.
Volume in USD.
Buy volume in USD. Null if protocol doesn’t provide directional data.
Sell volume in USD. Null if protocol doesn’t provide directional data.
The total volume usd.
The venue volume usd. Null if protocol doesn’t provide venue volume.
Volume in collateral token units.
Buy volume in collateral token units.
Sell volume in collateral token units.
Total volume in collateral token (nullable for old aggregates)
Venue volume in collateral token (nullable for old aggregates)
The number of trades.
The number of unique traders. Null if protocol doesn’t track unique traders.
The last event timestamp.
Liquidity in USD. Null if protocol doesn’t provide liquidity data.
See PredictionEventBarOhlc
Liquidity OHLC in collateral token (nullable for old aggregates)
See PredictionEventBarOhlc
Open interest in USD. Null if protocol doesn’t provide open interest data.
See PredictionEventBarOhlc
Data for the 5-minute resolution.
See PredictionEventBar
Show Properties
Show Properties
The unix timestamp for this bar.
Volume in USD.
Buy volume in USD. Null if protocol doesn’t provide directional data.
Sell volume in USD. Null if protocol doesn’t provide directional data.
The total volume usd.
The venue volume usd. Null if protocol doesn’t provide venue volume.
Volume in collateral token units.
Buy volume in collateral token units.
Sell volume in collateral token units.
Total volume in collateral token (nullable for old aggregates)
Venue volume in collateral token (nullable for old aggregates)
The number of trades.
The number of unique traders. Null if protocol doesn’t track unique traders.
The last event timestamp.
Liquidity in USD. Null if protocol doesn’t provide liquidity data.
See PredictionEventBarOhlc
Liquidity OHLC in collateral token (nullable for old aggregates)
See PredictionEventBarOhlc
Open interest in USD. Null if protocol doesn’t provide open interest data.
See PredictionEventBarOhlc
Data for the 15-minute resolution.
See PredictionEventBar
Show Properties
Show Properties
The unix timestamp for this bar.
Volume in USD.
Buy volume in USD. Null if protocol doesn’t provide directional data.
Sell volume in USD. Null if protocol doesn’t provide directional data.
The total volume usd.
The venue volume usd. Null if protocol doesn’t provide venue volume.
Volume in collateral token units.
Buy volume in collateral token units.
Sell volume in collateral token units.
Total volume in collateral token (nullable for old aggregates)
Venue volume in collateral token (nullable for old aggregates)
The number of trades.
The number of unique traders. Null if protocol doesn’t track unique traders.
The last event timestamp.
Liquidity in USD. Null if protocol doesn’t provide liquidity data.
See PredictionEventBarOhlc
Liquidity OHLC in collateral token (nullable for old aggregates)
See PredictionEventBarOhlc
Open interest in USD. Null if protocol doesn’t provide open interest data.
See PredictionEventBarOhlc
Data for the 30-minute resolution.
See PredictionEventBar
Show Properties
Show Properties
The unix timestamp for this bar.
Volume in USD.
Buy volume in USD. Null if protocol doesn’t provide directional data.
Sell volume in USD. Null if protocol doesn’t provide directional data.
The total volume usd.
The venue volume usd. Null if protocol doesn’t provide venue volume.
Volume in collateral token units.
Buy volume in collateral token units.
Sell volume in collateral token units.
Total volume in collateral token (nullable for old aggregates)
Venue volume in collateral token (nullable for old aggregates)
The number of trades.
The number of unique traders. Null if protocol doesn’t track unique traders.
The last event timestamp.
Liquidity in USD. Null if protocol doesn’t provide liquidity data.
See PredictionEventBarOhlc
Liquidity OHLC in collateral token (nullable for old aggregates)
See PredictionEventBarOhlc
Open interest in USD. Null if protocol doesn’t provide open interest data.
See PredictionEventBarOhlc
Data for the 1-hour resolution.
See PredictionEventBar
Show Properties
Show Properties
The unix timestamp for this bar.
Volume in USD.
Buy volume in USD. Null if protocol doesn’t provide directional data.
Sell volume in USD. Null if protocol doesn’t provide directional data.
The total volume usd.
The venue volume usd. Null if protocol doesn’t provide venue volume.
Volume in collateral token units.
Buy volume in collateral token units.
Sell volume in collateral token units.
Total volume in collateral token (nullable for old aggregates)
Venue volume in collateral token (nullable for old aggregates)
The number of trades.
The number of unique traders. Null if protocol doesn’t track unique traders.
The last event timestamp.
Liquidity in USD. Null if protocol doesn’t provide liquidity data.
See PredictionEventBarOhlc
Liquidity OHLC in collateral token (nullable for old aggregates)
See PredictionEventBarOhlc
Open interest in USD. Null if protocol doesn’t provide open interest data.
See PredictionEventBarOhlc
Data for the 4-hour resolution.
See PredictionEventBar
Show Properties
Show Properties
The unix timestamp for this bar.
Volume in USD.
Buy volume in USD. Null if protocol doesn’t provide directional data.
Sell volume in USD. Null if protocol doesn’t provide directional data.
The total volume usd.
The venue volume usd. Null if protocol doesn’t provide venue volume.
Volume in collateral token units.
Buy volume in collateral token units.
Sell volume in collateral token units.
Total volume in collateral token (nullable for old aggregates)
Venue volume in collateral token (nullable for old aggregates)
The number of trades.
The number of unique traders. Null if protocol doesn’t track unique traders.
The last event timestamp.
Liquidity in USD. Null if protocol doesn’t provide liquidity data.
See PredictionEventBarOhlc
Liquidity OHLC in collateral token (nullable for old aggregates)
See PredictionEventBarOhlc
Open interest in USD. Null if protocol doesn’t provide open interest data.
See PredictionEventBarOhlc
Data for the 12-hour resolution.
See PredictionEventBar
Show Properties
Show Properties
The unix timestamp for this bar.
Volume in USD.
Buy volume in USD. Null if protocol doesn’t provide directional data.
Sell volume in USD. Null if protocol doesn’t provide directional data.
The total volume usd.
The venue volume usd. Null if protocol doesn’t provide venue volume.
Volume in collateral token units.
Buy volume in collateral token units.
Sell volume in collateral token units.
Total volume in collateral token (nullable for old aggregates)
Venue volume in collateral token (nullable for old aggregates)
The number of trades.
The number of unique traders. Null if protocol doesn’t track unique traders.
The last event timestamp.
Liquidity in USD. Null if protocol doesn’t provide liquidity data.
See PredictionEventBarOhlc
Liquidity OHLC in collateral token (nullable for old aggregates)
See PredictionEventBarOhlc
Open interest in USD. Null if protocol doesn’t provide open interest data.
See PredictionEventBarOhlc
Data for the 1-day resolution.
See PredictionEventBar
Show Properties
Show Properties
The unix timestamp for this bar.
Volume in USD.
Buy volume in USD. Null if protocol doesn’t provide directional data.
Sell volume in USD. Null if protocol doesn’t provide directional data.
The total volume usd.
The venue volume usd. Null if protocol doesn’t provide venue volume.
Volume in collateral token units.
Buy volume in collateral token units.
Sell volume in collateral token units.
Total volume in collateral token (nullable for old aggregates)
Venue volume in collateral token (nullable for old aggregates)
The number of trades.
The number of unique traders. Null if protocol doesn’t track unique traders.
The last event timestamp.
Liquidity in USD. Null if protocol doesn’t provide liquidity data.
See PredictionEventBarOhlc
Liquidity OHLC in collateral token (nullable for old aggregates)
See PredictionEventBarOhlc
Open interest in USD. Null if protocol doesn’t provide open interest data.
See PredictionEventBarOhlc
Data for the 1-week resolution.
See PredictionEventBar
Show Properties
Show Properties
The unix timestamp for this bar.
Volume in USD.
Buy volume in USD. Null if protocol doesn’t provide directional data.
Sell volume in USD. Null if protocol doesn’t provide directional data.
The total volume usd.
The venue volume usd. Null if protocol doesn’t provide venue volume.
Volume in collateral token units.
Buy volume in collateral token units.
Sell volume in collateral token units.
Total volume in collateral token (nullable for old aggregates)
Venue volume in collateral token (nullable for old aggregates)
The number of trades.
The number of unique traders. Null if protocol doesn’t track unique traders.
The last event timestamp.
Liquidity in USD. Null if protocol doesn’t provide liquidity data.
See PredictionEventBarOhlc
Liquidity OHLC in collateral token (nullable for old aggregates)
See PredictionEventBarOhlc
Open interest in USD. Null if protocol doesn’t provide open interest data.
See PredictionEventBarOhlc
Arguments
The ID of the prediction event.
Subscription example
subscription {
onPredictionEventBarsUpdated(eventId: "67284:Polymarket:0xc5d563a36ae78145c45a50134d48a1215220f80a:137") {
bars {
min1 {
t
volumeUsd
buyVolumeUsd
sellVolumeUsd
totalVolumeUsd
venueVolumeUsd
volumeCollateralToken
trades
uniqueTraders
lastEventTimestamp
liquidityUsd {
o
h
l
c
}
openInterestUsd {
o
h
l
c
}
}
min5 {
t
volumeUsd
trades
uniqueTraders
liquidityUsd {
o
h
l
c
}
}
min15 {
t
volumeUsd
trades
}
hour1 {
t
volumeUsd
totalVolumeUsd
trades
}
hour4 {
t
volumeUsd
}
day1 {
t
volumeUsd
totalVolumeUsd
}
}
}
}
Example Response
{
"data": {
"onPredictionEventBarsUpdated": {
"bars": {
"min1": {
"t": 1773357360,
"volumeUsd": "1047.043738",
"buyVolumeUsd": "1046.940304",
"sellVolumeUsd": "0.103434",
"totalVolumeUsd": "183698948.904681",
"venueVolumeUsd": "350603420.708316",
"volumeCollateralToken": "1047.10344",
"trades": 5,
"uniqueTraders": 2,
"lastEventTimestamp": 1773357373,
"liquidityUsd": {
"o": "40568747.579197",
"h": "40569107.283499",
"l": "40568639.455529",
"c": "40568771.326025"
},
"openInterestUsd": {
"o": "34058066.149446",
"h": "34058066.149446",
"l": "34058066.149446",
"c": "34058066.149446"
}
},
"min5": {
"t": 1773357300,
"volumeUsd": "3347.885241",
"trades": 10,
"uniqueTraders": 3,
"liquidityUsd": {
"o": "40571553.036979",
"h": "40571553.036979",
"l": "40568639.455529",
"c": "40568771.326025"
}
},
"min15": {
"t": 1773357300,
"volumeUsd": "3347.885241",
"trades": 10
},
"hour1": {
"t": 1773356400,
"volumeUsd": "29290.703467",
"totalVolumeUsd": "183698948.904681",
"trades": 72
},
"hour4": {
"t": 1773345600,
"volumeUsd": "129468.523663"
},
"day1": {
"t": 1773273600,
"volumeUsd": "8580175.57018",
"totalVolumeUsd": "183698948.904681"
}
}
}
}
}
Usage Guidelines
- Event ID format varies by platform:
- Polymarket:
<eventSlug>:Polymarket:<exchangeAddress>:<networkId>(e.g.,67284:Polymarket:0xc5d563a36ae78145c45a50134d48a1215220f80a:137) - Kalshi:
<eventSlug>:Kalshi(e.g.,KXMVESPORTSMULTIGAMEEXTENDED-S2026350C4EF9BCE:Kalshi)
- Polymarket:
- Subscribe using
eventIdto receive live bar chart data for a prediction event - Bars are provided across multiple resolutions simultaneously:
min1,min5,min15,min30,hour1,hour4,hour12,day1, andweek1 - Updates stream whenever new trading activity occurs, recalculating affected bars
Troubleshooting Tips
Which resolution should I use for charting?
Which resolution should I use for charting?
Choose based on your timeframe:
min1 for tick-by-tick updates, min5 or min15 for short-term charts (1-hour view), hour1 or hour4 for medium-term (1-day to 1-week view), and day1 or week1 for long-term historical views. Request only the resolutions you need to reduce data volume.What does the timestamp (t) represent?
What does the timestamp (t) represent?
The
t field is the Unix timestamp marking the start of that bar’s time period. For example, a 5-minute bar with t: 1710345600 covers the period from that timestamp to 5 minutes later (1710345900). Bars are aligned to clean intervals (e.g., :00, :05, :10 for 5-minute bars).How do I interpret OHLC values for liquidity and open interest?
How do I interpret OHLC values for liquidity and open interest?
OHLC (Open, High, Low, Close) shows the range and direction of liquidity or open interest during that bar.
o is the value at the bar’s start, h is the maximum, l is the minimum, and c is the value at the bar’s end. This helps visualize how capital flow changed over time.What's the difference between volumeUsd and totalVolumeUsd?
What's the difference between volumeUsd and totalVolumeUsd?
volumeUsd is the trading volume that occurred during that specific bar period, while totalVolumeUsd is the cumulative all-time volume for the event up to that bar. Use volumeUsd for bar charts and totalVolumeUsd to show total market size.How often are bars updated?
How often are bars updated?
Bars update in real-time as trades occur. When a new trade happens, all affected bars (across all resolutions) are recalculated and pushed via the subscription. High-activity events may send updates multiple times per second during peak trading.
Do all resolutions always have data?
Do all resolutions always have data?
No. Bars only exist if there was activity during that time period. For events with sparse trading, you may receive null values for smaller resolutions (e.g.,
min1 or min5) while larger resolutions (e.g., hour1, day1) have data. Check for null before rendering.How do I handle bar updates for completed periods?
How do I handle bar updates for completed periods?
Bars are considered “complete” once their time period has passed. For example, a 1-minute bar starting at 12:00:00 is complete after 12:01:00. You can update your chart in real-time for the current incomplete bar and treat completed bars as final. Use
lastEventTimestamp to determine freshness.