> ## 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. predictionMarketPrice query reference: arguments and response fields.

> [!NOTE]
>
> 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).

> [!NOTE]
>
> 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](https://docs.codex.io/api-reference/queries/filterpredictionmarkets.md), which returns market rows with their current prices inline.

## 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
}
```

### Example

[Test this query in the Explorer →](https://docs.codex.io/explore.md)

```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](https://docs.codex.io/api-reference/queries/filterpredictionmarkets.md). It returns prices inline with each market row and is the better fit for multi-market UIs.
* Pair with [detailedPredictionMarketStats](https://docs.codex.io/api-reference/queries/detailedpredictionmarketstats.md) 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](https://docs.codex.io/api-reference/queries/predictiontraderholdings.md) to compute unrealized PnL on open positions.
* Supports markets on both Polymarket (Polygon) and Kalshi.

### Troubleshooting Tips

> [accordion] 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] 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] 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] 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](https://docs.codex.io/recipes/predictions/discover-markets.md): Learn how to build prediction market discovery pages with filtering, ranking, and search


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.