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.
This returns the order-book snapshot for a single market: best bid, best ask, last trade price, and spread per outcome. For prices across multiple markets at once (e.g. event pages, market lists), use filterPredictionMarkets, which returns market rows with their current prices inline.
Usage Guidelines
- Returns best bid, best ask, last trade price, and spread for each outcome of the market (typically YES / NO), in both USD and collateral-token (CT) units.
- Input accepts
marketId(required) andtimestamp(optional, Unix seconds). Omittimestampfor the latest snapshot; pass a timestamp to fetch the snapshot as of that time. - Best suited for single-market detail views where you need a richer quote (bid/ask/spread) than what list-level endpoints provide.
- For event pages or market lists, use filterPredictionMarkets. It returns prices inline with each market row and is the better fit for multi-market UIs.
- Pair with detailedPredictionMarketStats for aggregated market statistics (volume, trade counts, trending score, lifecycle). These endpoints are complementary:
detailedPredictionMarketStatsgives rolled-up activity;predictionMarketPricegives the current top-of-book. - Pair with predictionTraderHoldings to compute unrealized PnL on open positions.
- Supports markets on both Polymarket (Polygon) and Kalshi.
Troubleshooting Tips
When should I use this vs filterPredictionMarkets?
When should I use this vs filterPredictionMarkets?
filterPredictionMarkets is the right choice for event pages, market lists, and anywhere you’re showing multiple markets at once. Each market row includes its current price inline. predictionMarketPrice is for single-market drill-down views where you need the full quote snapshot (bid/ask/spread) rather than just a current price.What's the difference between the CT and Usd fields?
What's the difference between the CT and Usd fields?
Prediction markets price outcomes in their native collateral token (USDC on Polymarket, cents on Kalshi). The fields suffixed
CT (bestBidCT, bestAskCT, spreadCT, lastTradePriceCT) return the collateral-token value; the Usd-suffixed fields return the USD equivalent. Choose whichever matches how you display prices in your UI.Can I fetch historical price snapshots?
Can I fetch historical price snapshots?
Yes. Pass a Unix
timestamp in the input to get the snapshot as of that time. Omit timestamp to get the latest.Why are some market prices null or missing?
Why are some market prices null or missing?
The market may be newly listed with no activity yet, or the
marketId may be malformed. Confirm the marketId is correct and the market is on Polymarket or Kalshi.Related Recipes
- Discover Prediction Markets: Learn how to build prediction market discovery pages with filtering, ranking, and search