Optimism — Token price from top market (rank 1)

Prices WETH from its single top market rather than blending every pool — the recommended way to price one specific token. Replace `token` in the Variables pane, lowercase.

By gaurav · saved 27 August 2026 · Bitquery API v2

What it returns

Filters

The query

# Optimism - Price & OHLC - Token price from top market (rank 1)
#
# Ranking: {Position: {eq: 1}} prices the token from its single top market
# instead of blending every pool, which is what you want when you care about
# one specific token.
#
# Keep Price: {IsQuotedInUsd: true} - the rank filter selects the market, not
# the denomination.
#
# GOTCHA: Token.Address is stored lowercase and the filter is case-sensitive.
# A checksummed address returns zero rows and no error.
#
# Bitquery V2 query - send it to https://streaming.bitquery.io/graphql
#
# Datasets:  https://docs.bitquery.io/docs/graphql/dataset/archive/
# Retention: https://docs.bitquery.io/docs/graphql/data-coverage-retention/

query ($token: String!, $network: String!) {
  Trading {
    Pairs(
      where: {
        Token: { Address: { is: $token }, Network: { is: $network } }
        Ranking: { Position: { eq: 1 } }
        Interval: { Time: { Duration: { eq: 60 } } }
        Price: { IsQuotedInUsd: true }
      }
      orderBy: { descending: Block_Time }
      limit: { count: 1 }
    ) {
      Token { Symbol Name Address Network }
      QuoteToken { Symbol Address }
      Market { Name Address }
      Price { Ohlc { Open High Low Close } Average { Mean } IsQuotedInUsd }
      Volume { Usd Base Quote }
      Block { Time }
    }
  }
}

Variables

{"token": "0x4200000000000000000000000000000000000006", "network": "Optimism"}

Similar queries