Code Example
Check out this Github file for an example: https://github.com/TheNang2710/bds-public/blob/main/ws-base-quote.js1. WebSocket URL:
Header
2. Subscribe to Base-Quote Price (OHLCV)
To receive real-time updates about price changes for a specific token pair in the form of OHLCV data, use the following subscription message format:Subscription message
JSON
Subscription fields
Mode values
Usemode to control whether the WebSocket response includes raw OHLCV values, scaled OHLCV values, or both.
Sample response
JSON
Response fields
Implementation Example in JavaScript
Use the above github js code and runbash
solana: The blockchain chain to subscribe to (e.g., Solana).So11111111111111111111111111111111111111112: The base token address.EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v: The quote token address (e.g., USDC).1m: The chart type, which is the interval for OHLCV data (e.g., 1 minute).
- This example subscribes to real-time price updates for a token pair and logs the Open, High, Low, Close, and Volume data to the console. The subscription is automatically closed after 1 hour.
- This WebSocket only support 1 base-quote pair for 1 connection. You need to open another connection for new base-quote subscription.

