Subscribing to Real-Time Price Updates (SUBSCRIBE_PRICE)
The “SUBSCRIBE_PRICE” event allows you to receive real-time updates about price changes for tokens or token pairs. You can subscribe to price updates for individual tokens, token pairs, or a combination of both. This subscription is useful for tracking price movements and trends on the Birdeye platform.WebSocket Price Updates
Although the interval is 1 minute (or any supported interval), price updates occur whenever a transaction affects the price, reflecting the new close price within the interval. However, the aggregated price is updated based on an internal ranking pool mechanism, meaning not every transaction results in a price change. 🔹 We recommend implementing ping-pong checks and reconnection strategies when using WebSockets to ensure a stable connection and accurate price updates. You can use this Websocket to get real time price updates of following objects:- Token Price
- Pair (Market Price)
- Multiple Tokens/Pairs Price
Chain support: All chains
Scaled OHLCV values
Price WebSocket subscriptions can return raw OHLCV values, scaled OHLCV values, or both. Use themode field in your subscription payload to control which values are returned.
Supported
mode values:
Scaled responses may also include:
The instructions for each type of objects are described below.
Code Example
Checkout this Github file for an example:https://github.com/TheNang2710/bds-public/blob/main/wsPrice.js
1 - Subscribe Token Price (OHLCV)
To receive real-time updates about price changes for a specific token in the form of OHLCV (Open, High, Low, Close, Volume) data, you can use the following subscription message format:Input
mode to raw, scaled, or both to control which OHLCV fields are returned.
Set chartBy to mcap when you want to get OHLC by market cap value instead of price
Output Example
Response fields
2 - Subscribe Pair Price (OHLCV)
To receive real-time updates about price changes for a specific token pair in the form of OHLCV (Open, High, Low, Close, Volume) data, you can use the following subscription message format: Checkout this Github file for examplehttps://github.com/TheNang2710/bds-public/blob/main/wsPricePair.js

