total volume, outcome 1 volume, outcome 2 volume of a market

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 Kshitij Mahajan · saved 24 June 2026 · run 6 times · 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/
#
# For more info on the endpoint visit -
# https://docs.bitquery.io/docs/examples/polymarket-api/
# For faster results try using indexed feilds in where and orderBy clause -
# https://docs.bitquery.io/docs/graphql/indexed-fields-reference/

query MyQuery($marketAssets: [String!]){
  EVM(network: matic) {
    PredictionTrades(
      where: {Block: {Time: {since_relative: {hours_ago: 1}}}, TransactionStatus: {Success: true}, Trade:{Prediction:{OutcomeToken:{AssetId:{in:$marketAssets}}}}
      }
    ){
    Trade{
      Prediction{
        Question {
            Title
            ResolutionSource
            Image
            MarketId
            Id
            CreatedAt
          }
      }
    }
      yes_volume:sum(of:Trade_OutcomeTrade_CollateralAmountInUSD if:{Trade:{Prediction:{Outcome:{Label:{is:"Yes"}}}}})
      no_volume:sum(of:Trade_OutcomeTrade_CollateralAmountInUSD if:{Trade:{Prediction:{Outcome:{Label:{is:"No"}}}}})
      total_volume: sum(of:Trade_OutcomeTrade_CollateralAmountInUSD)
    }
  }
}

Variables

{
  "marketAssets": ["46746822541461330721074821991383617225657173789584499857683753079229786702095","70771354585365381988139008309072205730081182435161568795508496003376222185889"]
}

Similar queries