Skip to main content
Subscriptions (WebSockets) require a Growth or Enterprise plan. Learn more.

Returns

Arguments

Example Subscription

subscription {
  onPairMetadataUpdated(
    id: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1"
  ) {
    id
    pairAddress
    networkId
    liquidity
    statsType
    price
    priceNonQuoteToken
    priceChange5m
    priceChange1
    priceChange24
    volume5m
    volume1
    volume24
    token0 {
      address
      name
      symbol
      price
      pooled
      networkId
    }
    token1 {
      address
      name
      symbol
      price
      pooled
      networkId
    }
  }
}

Example Response

{
  "data": {
    "onPairMetadataUpdated": {
      "id": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1",
      "pairAddress": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
      "networkId": 1,
      "liquidity": "150000000",
      "statsType": "UNFILTERED",
      "price": "3245.67",
      "priceNonQuoteToken": "0.000308",
      "priceChange5m": 0.0012,
      "priceChange1": 0.0089,
      "priceChange24": -0.0234,
      "volume5m": "125000",
      "volume1": "2500000",
      "volume24": "45000000",
      "token0": {
        "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "name": "USD Coin",
        "symbol": "USDC",
        "price": "1.00",
        "pooled": "75000000",
        "networkId": 1
      },
      "token1": {
        "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        "name": "Wrapped Ether",
        "symbol": "WETH",
        "price": "3245.67",
        "pooled": "23100",
        "networkId": 1
      }
    }
  }
}

Usage Guidelines

  • Subscribe using the pair ID in format pairAddress:networkId (e.g., 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1)
  • Use quoteToken parameter (token0 or token1) to specify which token’s perspective to use for price data
  • Use useNonLiquidityTokenAsQuoteToken: true to automatically select the non-liquidity token as the quote token
  • Updates are pushed in real-time as trades occur on the pair
  • Price change fields (priceChange5m, priceChange1, etc.) are in decimal format (0.01 = 1%)
  • Volume fields represent USD value traded in the specified time window
  • Use statsType to see if stats are FILTERED (bot-filtered) or UNFILTERED

Troubleshooting Tips

Use the filterPairs or listPairsForToken query to find the pair address and network ID for your token. The subscription ID format is pairAddress:networkId.
Updates are only pushed when trades occur on the pair. Low-activity pairs may have infrequent updates. Ensure your WebSocket connection is properly established and you’re subscribed to an active pair.
Token ordering is determined by the pair contract. Use the quoteToken parameter to specify which token you want as the base for price calculations, or use useNonLiquidityTokenAsQuoteToken: true to automatically select the non-stable/non-major token.
Implement reconnection logic in your client. When reconnecting, you’ll need to re-subscribe to the pairs you were monitoring. Consider using a library like graphql-ws that handles reconnections automatically.
Yes, you can open multiple subscriptions for different pairs over the same WebSocket connection. Each subscription operates independently and will receive updates for its specific pair.