Top-AI-markets-by-volume-Polymarket

Historical data This query uses the realtime dataset (the default), which holds only a recent window - hours to days depending on the cube. For older data add a dataset to the top-level element: EVM(network: matic, dataset: combined) archive full history combined archive + realtime in one result

By Divyasshree · saved 9 June 2026 · run 1 time · Bitquery API v2

What it returns

Filters

The query

# Historical data
#   This query uses the realtime dataset (the default), which holds only a
#   recent window - hours to days depending on the cube.
#
#   For older data add a dataset to the top-level element:
#
#     EVM(network: matic, dataset: combined)
#
#     archive   full history
#     combined  archive + realtime in one result
#
#   Archive and combined need the historical data add-on:
#   https://bitquery.io/pricing
#
# Datasets:  https://docs.bitquery.io/docs/graphql/dataset/archive/
# Retention: https://docs.bitquery.io/docs/graphql/data-coverage-retention/
#

query TopAIMarketsByVolume($time_ago: Int!, $limit: Int!) {
  EVM(network: matic) {
    PredictionTrades(
      where: {Block: {Time: {since_relative: {hours_ago: $time_ago}}}, Trade: {Prediction: {Marketplace: {ProtocolName: {is: "polymarket"}}, Question: {Title: {includesCaseInsensitive: " AI "}}}}}
      limit: {count: $limit}
      orderBy: {descendingByField: "sumBuyAndSell"}
    ) {
      Trade {
        Prediction {
          Question {
            Id
            Image
            Title
            MarketId
            CreatedAt
          }
        }
      }
      buyUSD: sum(
        of: Trade_OutcomeTrade_CollateralAmountInUSD
        if: {Trade: {OutcomeTrade: {IsOutcomeBuy: true}}}
      )
      sellUSD: sum(
        of: Trade_OutcomeTrade_CollateralAmountInUSD
        if: {Trade: {OutcomeTrade: {IsOutcomeBuy: false}}}
      )
      sumBuyAndSell: calculate(expression: "$buyUSD + $sellUSD")
      trades: count
      buyers: count(distinct: Trade_OutcomeTrade_Buyer)
      sellers: count(distinct: Trade_OutcomeTrade_Seller)
    }
  }
}

Variables

{
  "time_ago": 24,
  "limit": 100
}

Similar queries