> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobula.io/llms.txt
> Use this file to discover all available pages before exploring further.

# onPriceUpdated

> Live-streamed price updates for a single token or pair.

<Note>
  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.
</Note>

### Returns

<ResponseField name="onPriceUpdated" type="Price!">
  Price update payload. See [Price](/api-reference/graphql/types/Price).
</ResponseField>

### Arguments

<ResponseField name="address" type="String">
  Token contract address. Required unless `sourcePairAddress` is provided.
</ResponseField>

<ResponseField name="networkId" type="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.
</ResponseField>

<ResponseField name="sourcePairAddress" type="String">
  Pair contract address from which to derive pricing. Defaults to the top pair for the token.
</ResponseField>

<ResponseField name="useWeightedPrices" type="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.
</ResponseField>

### 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)

```graphql theme={null}
subscription {
  onPriceUpdated(
    address: "0x6982508145454ce325ddbe47a25d4ec3d2311933"
    networkId: 1
  ) {
    address
    networkId
    priceUsd
    timestamp
    blockNumber
  }
}
```

### Example — weighted

```graphql theme={null}
subscription {
  onPriceUpdated(
    address: "0x6982508145454ce325ddbe47a25d4ec3d2311933"
    networkId: 1
    useWeightedPrices: true
  ) {
    address
    priceUsd
    timestamp
  }
}
```

### Example — pinned to a specific pair

```graphql theme={null}
subscription {
  onPriceUpdated(
    address: "0x6982508145454ce325ddbe47a25d4ec3d2311933"
    networkId: 1
    sourcePairAddress: "0x11950d141ecb863f01007add7d1a342041227b58"
  ) {
    priceUsd
    timestamp
    blockNumber
  }
}
```
