Skip to main content
Subscriptions use wss://graphql.mobula.io/graphql with the graphql-transport-ws protocol. wss://graphql.mobula.io/graphql/subscriptions is also supported for backwards compatibility.

Returns

onPriceUpdated
Price!
Price update payload. See Price.

Arguments

address
String
Token contract address. Required unless sourcePairAddress is provided.
networkId
Int
Network ID the token is deployed on (e.g. 1 for Ethereum, 1399811149 for Solana). Required at runtime when address is used — pair the two.
sourcePairAddress
String
Pair contract address from which to derive pricing. Defaults to the top pair for the token.
useWeightedPrices
Boolean
When true, subscribe to liquidity-weighted token prices aggregated across all of the token’s pools instead of pair-derived prices. Not supported when sourcePairAddress is provided.

Behavior

  • Triggered by every swap on the token’s pools (or on the specified pair when sourcePairAddress is set).
  • In pair-derived mode (default), priceUsd reflects the swap’s pool ratio. Different pools of the same token can report slightly different prices.
  • In weighted mode, priceUsd reflects the token-level liquidity-weighted aggregate across all of the token’s pools — smoother, less sensitive to single-pool noise.

Example — pair-derived (default)

subscription {
  onPriceUpdated(
    address: "0x6982508145454ce325ddbe47a25d4ec3d2311933"
    networkId: 1
  ) {
    address
    networkId
    priceUsd
    timestamp
    blockNumber
  }
}

Example — weighted

subscription {
  onPriceUpdated(
    address: "0x6982508145454ce325ddbe47a25d4ec3d2311933"
    networkId: 1
    useWeightedPrices: true
  ) {
    address
    priceUsd
    timestamp
  }
}

Example — pinned to a specific pair

subscription {
  onPriceUpdated(
    address: "0x6982508145454ce325ddbe47a25d4ec3d2311933"
    networkId: 1
    sourcePairAddress: "0x11950d141ecb863f01007add7d1a342041227b58"
  ) {
    priceUsd
    timestamp
    blockNumber
  }
}