Overview
ChainStream DEX WebSocket API provides real-time data subscription services, supporting the following data types:- Candle Data
- Token Series
- Wallet Series
- Ranking Series
- Trade Series
- DexPool Series
Quick Start
1. Establish Connection
First, create a WebSocket connection. WebSocket connections require thetoken query parameter in the URL for authentication.
- Using SDK (Recommended)
- Using Native WebSocket
- Command Line Testing
If using the Go or JavaScript SDK, authentication is handled automatically:SDK Installation:
When calling
subscribeXXX methods, SDK automatically checks connection status and establishes connection if not connected. No need to manually call connect().2. Subscribe to Data
Choose the data type you want to subscribe to:3. Handle Data
Data Subscriptions
Candles
Candles Data
Get real-time price movement data for tokens. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Token contract address, e.g., 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
string
required
Candle period, supports: 1m, 5m, 15m, 1h, 4h, 1d
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: volume > 1000
- WebSocket API
- SDK
Token Series
Token Stats
Get real-time market statistics for tokens. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Token contract address, e.g., 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: price > 0.01
- WebSocket API
- SDK
Token Holders Statistics
Get real-time token holder statistics. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Token contract address, e.g., 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: holders > 200
- WebSocket API
- SDK
New Token Metadata
Get real-time metadata for newly listed tokens. Subscription Formatstring
required
Blockchain name, e.g., sol
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: name == “USDC”
- WebSocket API
- SDK
New Token
Get information about newly created token. Subscription Formatstring
required
Blockchain name, e.g., sol
- WebSocket API
- SDK
Token Supply
Get real-time token supply and market cap information. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Token contract address, e.g., 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: supply > 1000000
- WebSocket API
- SDK
Token Liquidity
Get real-time token liquidity statistics. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Token contract address
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: value > 1000000
- WebSocket API
- SDK
Token Max Liquidity
Get real-time max liquidity info of a token in a single pool. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Token contract address
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: liquidityInUsd > 10000
- WebSocket API
- SDK
Token Total Liquidity
Get real-time total liquidity info of a token across all pools. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Token contract address
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: liquidityInUsd > 50000
- WebSocket API
- SDK
Ranking Series
Ranking Token Statistics
Get real-time market statistics for ranking tokens. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Channel type, support:new、trending、us_stocks、completed、graduated
- WebSocket API
- SDK
Ranking Token Holders Statistics
Get real-time token holder statistics for ranking tokens. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Channel type, support:new、trending、us_stocks、completed、graduated
- WebSocket API
- SDK
Ranking Token Supply Data
Get real-time supply and market cap information for ranking tokens. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Channel type, support:new、trending、us_stocks、completed、graduated
- WebSocket API
- SDK
Ranking Token Liquidity Data
Get real-time liquidity statistics for ranking tokens. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Channel type, support:new、trending、us_stocks、completed、graduated
- WebSocket API
- SDK
Ranking Token List
Get real-time complete information list for ranking tokens, including metadata, holder statistics, supply and market data. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Ranking type, support:new、trending、us_stocks、completed、graduated
string
Optional DEX platform, support:pump_fun、raydium_launchpad、meteora_dynamic_bounding_curve、bonk_fun、boop_fun、moonit_fun
- WebSocket API
- SDK
Ranking Tokens Bonding Curve
Get real-time bonding curve progress for newly listed tokens. Subscription Formatstring
required
Blockchain name, e.g., sol
- WebSocket API
- SDK
Wallet Series
Wallet Balance
Get real-time wallet balance information. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Wallet address, e.g., HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: balance > 1000
- WebSocket API
- SDK
Wallet PnL Data (Token Level)
Get real-time wallet profit and loss (PnL) statistics. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Wallet address
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: buyAmount > 1000
- WebSocket API
- SDK
Wallet PnL Data (Wallet Level)
Get real-time wallet overall profit and loss statistics. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Wallet address
- WebSocket API
- SDK
Trade Series
Token Trade
Get real-time token trading events. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Token contract address, e.g., 6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: buyAmount > 100
- WebSocket API
- SDK
Wallet Trade
Get real-time wallet trading event. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Token contract address, e.g., GDekof7TtgeBKJtoVpkvzPin5mvhxSDyoUY2c1FK1T3i
- WebSocket API
- SDK
DexPool Series
DEX Pool Balance
Get real-time DEX pool balance information. Subscription Formatstring
required
Blockchain name, e.g., sol
string
required
Pool address
- WebSocket API
- SDK
Usage Examples
Reconnection Strategy
Recommended to use exponential backoff for reconnection:Usage Limits
Best Practices
-
Connection Management
- Maintain a single WebSocket connection
- Implement automatic reconnection
- Send regular heartbeats
-
Error Handling
- Implement complete error handling
- Log detailed error information
- Use exponential backoff for reconnection
-
Performance Optimization
- Control subscription quantity
- Implement message queue mechanism
- Clean up unused subscriptions
Complete Example
- Using SDK (Recommended)
- Native WebSocket
When using the SDK, authentication, reconnection, heartbeat, etc. are all handled automatically. Recommended for production environments.
- TypeScript/JavaScript SDK: @chainstream-io/sdk
- Python SDK: chainstream-sdk
- Go SDK: chainstream-go-sdk
- Rust SDK: chainstream-sdk

