> ## 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.

# predictionMarketPrice

> Returns price data for a prediction market at a specific timestamp or latest.

<Info>
  **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.

  At least for the time being, this endpoint requires a Growth or Enterprise plan. [Learn more](https://dashboard.codex.io/dashboard/billing?utm_source=codex\&utm_medium=docs\&utm_campaign=billing).
</Info>

<Info>
  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](/api-reference/queries/filterpredictionmarkets), which returns market rows with their current prices inline.
</Info>

<div data-generated>
  ## GraphQL

  ```
  type Query {
    # Requires a Growth or Enterprise plan.
    predictionMarketPrice(
      input: PredictionMarketPriceInput!
    ): PredictionMarketPrice
  }

  type PredictionMarketOutcomePrice {
    outcomeId: String!
    lastTradePriceUsd: String
    lastTradePriceCT: String
    bestBidUsd: String
    bestBidCT: String
    bestAskUsd: String
    bestAskCT: String
    spreadUsd: String
    spreadCT: String
    bestBookBidUsd: String
    bestBookBidCT: String
    bestBookAskUsd: String
    bestBookAskCT: String
    bookLiquidityUsd: String
    bookLiquidityCT: String
    timestamp: Int!
  }

  type PredictionMarketPrice {
    marketId: String!
    timestamp: Int!
    outcomes: [PredictionMarketOutcomePrice!]!
  }

  input PredictionMarketPriceInput {
    marketId: String!
    timestamp: Int
  }
  ```
</div>

### Example

<a href="/explore" target="_blank" rel="noopener noreferrer">Test this query in the Explorer →</a>

```graphql theme={null}
{
  predictionMarketPrice(
    input: {marketId: "0x5a59d269c2b5108cd2f64c624e46ee2c8b5cfd88b882582565f927918315b6aa:Polymarket:0xc5d563a36ae78145c45a50134d48a1215220f80a:137"}
  ) {
    outcomes {
      bestAskCT
      bestAskUsd
      bestBidCT
      bestBidUsd
      lastTradePriceCT
      lastTradePriceUsd
      outcomeId
      spreadCT
      spreadUsd
      timestamp
    }
  }
}
```

### 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) and `timestamp` (optional, Unix seconds). Omit `timestamp` for 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](/api-reference/queries/filterpredictionmarkets). It returns prices inline with each market row and is the better fit for multi-market UIs.
* Pair with [detailedPredictionMarketStats](/api-reference/queries/detailedpredictionmarketstats) for aggregated market statistics (volume, trade counts, trending score, lifecycle). These endpoints are complementary: `detailedPredictionMarketStats` gives rolled-up activity; `predictionMarketPrice` gives the current top-of-book.
* Pair with [predictionTraderHoldings](/api-reference/queries/predictiontraderholdings) to compute unrealized PnL on open positions.
* Supports markets on both Polymarket (Polygon) and Kalshi.

### Troubleshooting Tips

<AccordionGroup>
  <Accordion title="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.
  </Accordion>

  <Accordion title="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.
  </Accordion>

  <Accordion title="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.
  </Accordion>

  <Accordion title="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.
  </Accordion>
</AccordionGroup>

### Related Recipes

* [Discover Prediction Markets](/recipes/discover-prediction-markets): Learn how to build prediction market discovery pages with filtering, ranking, and search
