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

# detailedPredictionMarketStats

> Returns windowed and all-time stats for a prediction market.

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

<div data-generated>
  ## GraphQL

  ```
  type Query {
    # Requires a Growth or Enterprise plan.
    detailedPredictionMarketStats(
      input: DetailedPredictionMarketStatsInput!
    ): DetailedPredictionMarketStats
  }

  enum PredictionProtocol {
    POLYMARKET
    KALSHI
  }

  type PredictionResolution {
    result: String
    source: String
  }

  type PredictionSubSubcategory {
    name: String!
    slug: String!
  }

  type PredictionSubcategory {
    name: String!
    slug: String!
    subcategories: [PredictionSubSubcategory!]
  }

  type PredictionCategory {
    name: String!
    slug: String!
    subcategories: [PredictionSubcategory!]
  }

  enum PredictionMetadataType {
    SPORTS
  }

  type SportsTeam {
    abbreviation: String!
    altAbbreviations: [String!]
    name: String
    league: String
    logo: String
    alias: String
    color: String
    providerId: Int
    isHome: Boolean
  }

  enum SportsTimezone {
    UTC
  }

  type SportsMarketEnrichedMetadata {
    sportsMarketType: String
    league: String
    teams: [SportsTeam!]
    gameStartDate: String
    gameStartTime: String
    gameStartTimeSeconds: Int
    gameStartTimezone: SportsTimezone
  }

  type PredictionMarketEnrichedMetadata {
    metadataType: PredictionMetadataType!
    sports: SportsMarketEnrichedMetadata
  }

  type PredictionMarket {
    id: String!
    protocol: PredictionProtocol!
    venueMarketId: String!
    venueMarketSlug: String
    eventId: String
    venueEventId: String
    question: String
    label: String
    suggestedLabel: String
    eventLabel: String
    rules: String
    rules2: String
    venueOutcomeIds: [String!]!
    outcomeIds: [String!]!
    outcomeLabels: [String!]
    resolution: PredictionResolution
    imageLargeUrl: String
    imageThumbUrl: String
    imageSmallUrl: String
    createdAt: Int
    updatedAt: Int
    opensAt: Int
    closesAt: Int
    resolvesAt: Int
    resolvedAt: Int
    observedAt: Int!
    networkId: Int
    exchangeAddress: String
    categories: [PredictionCategory!]
    winningOutcomeId: String
    enrichedMetadata: PredictionMarketEnrichedMetadata
  }

  enum PredictionEventStatus {
    OPEN
    SUSPENDED
    RESOLVED
    CANCELLED
    PENDING
  }

  type KalshiSportsTickerComponents {
    rawTicker: String!
    seriesPrefix: String!
    seriesSport: String
    teamTailRaw: String
    homeAbbreviation: String
    awayAbbreviation: String
  }

  type DecomposedVenueTicker {
    kalshiSports: KalshiSportsTickerComponents
  }

  type SportsEventEnrichedMetadata {
    league: String
    teams: [SportsTeam!]
    gameStartDate: String
    gameStartTime: String
    gameStartTimeSeconds: Int
    gameStartTimezone: SportsTimezone
    decomposedVenueTicker: DecomposedVenueTicker
  }

  type PredictionEventEnrichedMetadata {
    metadataType: PredictionMetadataType!
    sports: SportsEventEnrichedMetadata
  }

  type PredictionEvent {
    id: String!
    protocol: PredictionProtocol!
    venueEventId: String!
    venueSeriesId: String
    status: PredictionEventStatus!
    question: String!
    url: String!
    rulesPrimary: String!
    rulesSecondary: String
    tags: [String!]!
    opensAt: Int!
    closesAt: Int
    resolvesAt: Int
    resolvedAt: Int
    resolution: PredictionResolution
    imageLargeUrl: String
    imageThumbUrl: String
    imageSmallUrl: String
    createdAt: Int!
    updatedAt: Int!
    networkId: Int
    marketIds: [String!]
    categories: [PredictionCategory!]
    enrichedMetadata: PredictionEventEnrichedMetadata
  }

  type PredictionLifecycleStats {
    ageSeconds: Int!
    expectedLifespanSeconds: Int
    timeToResolutionSeconds: Int
    isResolved: Boolean!
    winningOutcomeId: String
  }

  type CurrencyValuePair {
    usd: String!
    ct: String!
  }

  type WindowedPredictionMarketCoreStats {
    volume: CurrencyValuePair!
    trades: Int!
  }

  type WindowedPredictionMarketUniqueTraderStats {
    uniqueTraders: Int!
  }

  type CurrencyOHLC {
    open: CurrencyValuePair!
    close: CurrencyValuePair!
    low: CurrencyValuePair!
    high: CurrencyValuePair!
  }

  type WindowedPredictionMarketLiquidityStats {
    liquidity: CurrencyOHLC!
  }

  type WindowedPredictionMarketOpenInterestStats {
    openInterest: CurrencyOHLC!
  }

  type WindowedPredictionMarketChangeStats {
    volumeChange: Float!
    tradesChange: Float!
    uniqueTradersChange: Float
    liquidityChange: Float
    openInterestChange: Float
  }

  type PredictionMarketWindowScores {
    trending: Float!
    relevance: Float!
    competitive: Float!
  }

  type OutcomeVolumeStats {
    usd: String!
    ct: String!
    shares: String!
  }

  type PriceValuePair {
    usd: String!
    ct: String!
  }

  type PriceOHLC {
    open: PriceValuePair!
    close: PriceValuePair!
    low: PriceValuePair!
    high: PriceValuePair!
  }

  type WindowedPredictionOutcomeCoreStats {
    venueOutcomeId: String!
    trades: Int!
    volume: OutcomeVolumeStats!
    price: PriceOHLC!
  }

  type OutcomeBuySellVolumeStats {
    usd: String!
    ct: String!
    shares: String!
  }

  type WindowedPredictionOutcomeBuySellStats {
    buys: Int!
    sells: Int!
    buyVolume: OutcomeBuySellVolumeStats!
    sellVolume: OutcomeBuySellVolumeStats!
  }

  type WindowedPredictionOutcomeLiquidityStats {
    liquidity: CurrencyOHLC!
  }

  type WindowedPredictionOutcomeOrderbookStats {
    bid: PriceOHLC!
    ask: PriceOHLC!
  }

  type WindowedPredictionOutcomeDepthStats {
    bidDepth: CurrencyOHLC!
    askDepth: CurrencyOHLC!
  }

  type WindowedPredictionOutcomeChangeStats {
    volumeChange: Float!
    volumeSharesChange: Float!
    priceChange: Float!
    tradesChange: Float!
    priceRange: Float!
    buysChange: Float
    sellsChange: Float
    liquidityChange: Float
  }

  type EnhancedWindowedPredictionOutcomeStats {
    core: WindowedPredictionOutcomeCoreStats!
    buySell: WindowedPredictionOutcomeBuySellStats
    liquidity: WindowedPredictionOutcomeLiquidityStats
    orderbook: WindowedPredictionOutcomeOrderbookStats
    depth: WindowedPredictionOutcomeDepthStats
    statsChange: WindowedPredictionOutcomeChangeStats!
  }

  type WindowedPredictionAllTimeStats {
    volume: CurrencyValuePair!
    venueVolume: CurrencyValuePair
  }

  type EnhancedWindowedPredictionMarketStats {
    start: Int!
    end: Int!
    lastTransactionAt: Int!
    core: WindowedPredictionMarketCoreStats!
    uniqueTraders: WindowedPredictionMarketUniqueTraderStats
    liquidity: WindowedPredictionMarketLiquidityStats
    openInterest: WindowedPredictionMarketOpenInterestStats
    statsChange: WindowedPredictionMarketChangeStats!
    scores: PredictionMarketWindowScores!
    outcome0Stats: EnhancedWindowedPredictionOutcomeStats!
    outcome1Stats: EnhancedWindowedPredictionOutcomeStats!
    allTimeStats: WindowedPredictionAllTimeStats!
  }

  type DetailedPredictionStatsScores {
    score5m: Float
    score1: Float
    score4: Float
    score12: Float
    score24: Float
    score1w: Float
  }

  type PredictionMarketAllTimeStats {
    volume: CurrencyValuePair!
    venueVolume: CurrencyValuePair
  }

  type DetailedPredictionMarketStats {
    marketId: String!
    predictionMarket: PredictionMarket!
    predictionEvent: PredictionEvent!
    lastTransactionAt: Int!
    lifecycle: PredictionLifecycleStats!
    statsMin5: EnhancedWindowedPredictionMarketStats
    statsHour1: EnhancedWindowedPredictionMarketStats
    statsHour4: EnhancedWindowedPredictionMarketStats
    statsHour12: EnhancedWindowedPredictionMarketStats
    statsDay1: EnhancedWindowedPredictionMarketStats
    statsWeek1: EnhancedWindowedPredictionMarketStats
    trendingScores: DetailedPredictionStatsScores!
    relevanceScores: DetailedPredictionStatsScores!
    competitiveScores: DetailedPredictionStatsScores!
    allTimeStats: PredictionMarketAllTimeStats!
  }

  enum PredictionStatsDuration {
    week1
    day1
    hour12
    hour4
    hour1
    min5
  }

  input DetailedPredictionMarketStatsInput {
    marketId: String!
    timestamp: Int
    durations: [PredictionStatsDuration!]
    bucketCount: Int
  }
  ```
</div>

## Query example

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

Get detailed stats for a specific market

```graphql theme={null}
{
  detailedPredictionMarketStats(
    input: {
      marketId: "0x25aa90b3cd98305e849189b4e8b770fc77fe89bccb7cf9656468414e01145d38:Polymarket:0xc5d563a36ae78145c45a50134d48a1215220f80a:137"
    }
  ) {
    predictionMarket {
      protocol
      question
      label
      closesAt
      resolvedAt
      createdAt
      eventId
      venueMarketSlug
    }
    statsHour1 {
      core {
        volume {
          usd
        }
        trades
      }
      uniqueTraders {
        uniqueTraders
      }
      scores {
        trending
        relevance
        competitive
      }
    }
    statsHour4 {
      core {
        volume {
          usd
        }
      }
      statsChange {
        volumeChange
        uniqueTradersChange
      }
    }
    statsDay1 {
      core {
        volume {
          usd
        }
      }
      liquidity {
        liquidity {
          close {
            usd
          }
        }
      }
      openInterest {
        openInterest {
          close {
            usd
          }
        }
      }
      uniqueTraders {
        uniqueTraders
      }
      scores {
        trending
        relevance
        competitive
      }
    }
    allTimeStats {
      volume {
        usd
      }
      venueVolume {
        usd
      }
    }
  }
}
```

```json Example response theme={null}
{
  "data": {
    "detailedPredictionMarketStats": {
      "predictionMarket": {
        "protocol": "POLYMARKET",
        "question": "Will the Fed increase interest rates by 25+ bps after the March 2026 meeting?",
        "label": "25+ bps increase",
        "closesAt": 1773792000,
        "resolvedAt": null,
        "createdAt": 1761685086,
        "eventId": "67284:Polymarket:0xc5d563a36ae78145c45a50134d48a1215220f80a:137",
        "venueMarketSlug": "will-the-fed-increase-interest-rates-by-25-bps-after-the-march-2026-meeting"
      },
      "statsHour1": {
        "core": {
          "volume": {
            "usd": "293166"
          },
          "trades": 45
        },
        "uniqueTraders": {
          "uniqueTraders": 36
        },
        "scores": {
          "trending": 0.21045977756048143,
          "relevance": 0.888706858311519,
          "competitive": 0.22740250415693916
        }
      },
      "statsHour4": {
        "core": {
          "volume": {
            "usd": "1649050"
          }
        },
        "statsChange": {
          "volumeChange": 4.743497401747029,
          "uniqueTradersChange": 0.19827586206896552
        }
      },
      "statsDay1": {
        "core": {
          "volume": {
            "usd": "4878915"
          }
        },
        "liquidity": {
          "liquidity": {
            "close": {
              "usd": "16546011"
            }
          }
        },
        "openInterest": {
          "openInterest": {
            "close": {
              "usd": "8237311"
            }
          }
        },
        "uniqueTraders": {
          "uniqueTraders": 554
        },
        "scores": {
          "trending": 0.2711821948088767,
          "relevance": 0.9832798636422668,
          "competitive": 0.33942966597666013
        }
      },
      "allTimeStats": {
        "volume": {
          "usd": "70882915"
        },
        "venueVolume": {
          "usd": "122908278"
        }
      }
    }
  }
}
```

### Usage Guidelines

* Use this query to get comprehensive statistics for a single prediction market
* Market stats provide granular data for a specific outcome within an event
* Windowed statistics are available for multiple time periods: 5min, 1h, 4h, 12h, 1d, 1w
* **Market ID formats** vary by protocol:
  * **Polymarket**: `<marketAddress>:Polymarket:<exchangeAddress>:<networkId>` (e.g., `0x25aa90b3cd98305e849189b4e8b770fc77fe89bccb7cf9656468414e01145d38:Polymarket:0xc5d563a36ae78145c45a50134d48a1215220f80a:137`)
  * **Kalshi**: `<marketSlug>:Kalshi` (e.g., `KXMVECROSSCATEGORY-S2026A4A05B370DF-F1FBA451AA9:Kalshi`)
* Find market IDs using [`filterPredictionMarkets`](/api-reference/queries/filterpredictionmarkets) or from the `id` field on markets
* Returns `null` if the market doesn't exist or has no available data
* For aggregated stats across all markets in an event, use [`detailedPredictionEventStats`](/api-reference/queries/detailedpredictioneventstats)

### Understanding Scores

* **trending** - Measures what's "heating up" - prioritizes growth velocity over absolute size (a small market with 10x volume growth scores higher than a large market with flat volume)
* **relevance** - Measures what "matters" - based on absolute size and capital at stake, with no growth multipliers (large, established markets rank high even if quiet)
* **competitive** - Measures genuine uncertainty - higher when prices are near 50%, trading is balanced on both sides, and there's active price discovery

### Troubleshooting Tips

<AccordionGroup>
  <Accordion title="What's the difference between market stats and event stats?">
    Market stats show data for a single outcome, while event stats aggregate across all markets in an event. Use [`detailedPredictionEventStats`](/api-reference/queries/detailedpredictioneventstats) for aggregated stats.
  </Accordion>

  <Accordion title="How do I find market IDs?">
    Use [`filterPredictionMarkets`](/api-reference/queries/filterpredictionmarkets) to search for markets, or get the `id` field from any market query.
  </Accordion>

  <Accordion title="How do I interpret the score values?">
    * **Trending** (0-1): 0.9+ = explosive growth (10x+ volume spikes, rapid trader influx)
    * **Relevance** (0-1): 0.9+ = large capital deployment (high volume, deep liquidity)
    * **Competitive** (0-1): 0.7+ = genuine uncertainty (prices near 50%, balanced trading). Low scores (\< 0.3) = market reached consensus.
  </Accordion>
</AccordionGroup>
