🪙Prices
Subscribing and Unsubscribing to Prices
Our WebSocket API provides real-time price data, allowing you to subscribe and receive price updates for one or many assets. To manage your subscriptions, you'll need to send structured messages over your established WebSocket connection. Below are the details on subscribing to and unsubscribing from price updates on specified asset_ids.
Subscribing to Price Updates
To start receiving real-time updates for a token, you need to send a subscription message over your WebSocket connection. The message should specify that you wish to subscribe ("action": "subscribe"
) to prices ("subscription_type": "Prades"
) for an array of asset IDs.
Here's the structure of the subscription message you should send:
Replace YourAssetID
with the identifiers of the assets you are interested in. For example, if you want to subscribe to two tokens on BSC, your message might look like this:
Unsubscribing from Price Updates
If you wish to stop receiving updates for an asset, you can unsubscribe by sending a similar message with the action set to "unsubscribe"
:
Receiving Price Updates
Once you've successfully subscribed, trade updates will be sent to your WebSocket connection in real-time. These messages will follow this format:
Please note, that these updates will be for any trade involving this token across all liquidity pools on our supported dexes.
Last updated