Skip to main content

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
Base URL

Quick Start

1. Establish Connection

First, create a WebSocket connection. WebSocket connections require the token query parameter in the URL for authentication.

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 Format
Parameters
string
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
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

Token Series

Token Stats

Get real-time market statistics for tokens. Subscription Format
Parameters
string
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
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

Token Holders Statistics

Get real-time token holder statistics. Subscription Format
Parameters
string
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
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

New Token Metadata

Get real-time metadata for newly listed tokens. Subscription Format
Parameters
string
required
Blockchain name, e.g., sol
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: name == “USDC”
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

New Token

Get information about newly created token. Subscription Format
Parameters
string
required
Blockchain name, e.g., sol
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

Token Supply

Get real-time token supply and market cap information. Subscription Format
Parameters
string
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
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names for better code readability.

Token Liquidity

Get real-time token liquidity statistics. Subscription Format
Parameters
string
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
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names for better code readability.

Token Max Liquidity

Get real-time max liquidity info of a token in a single pool. Subscription Format
Parameters
string
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
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names for better code readability.

Token Total Liquidity

Get real-time total liquidity info of a token across all pools. Subscription Format
Parameters
string
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
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names for better code readability.

Ranking Series

Ranking Token Statistics

Get real-time market statistics for ranking tokens. Subscription Format
Parameters
string
required
Blockchain name, e.g., sol
string
required
Channel type, support:new、trending、us_stocks、completed、graduated
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

Ranking Token Holders Statistics

Get real-time token holder statistics for ranking tokens. Subscription Format
Parameters
string
required
Blockchain name, e.g., sol
string
required
Channel type, support:new、trending、us_stocks、completed、graduated
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

Ranking Token Supply Data

Get real-time supply and market cap information for ranking tokens. Subscription Format
Parameters
string
required
Blockchain name, e.g., sol
string
required
Channel type, support:new、trending、us_stocks、completed、graduated
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

Ranking Token Liquidity Data

Get real-time liquidity statistics for ranking tokens. Subscription Format
Parameters
string
required
Blockchain name, e.g., sol
string
required
Channel type, support:new、trending、us_stocks、completed、graduated
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

Ranking Token List

Get real-time complete information list for ranking tokens, including metadata, holder statistics, supply and market data. Subscription Format
Parameters
string
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
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

Ranking Tokens Bonding Curve

Get real-time bonding curve progress for newly listed tokens. Subscription Format
Parameters
string
required
Blockchain name, e.g., sol
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

Wallet Series

Wallet Balance

Get real-time wallet balance information. Subscription Format
Parameters
string
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
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

Wallet PnL Data (Token Level)

Get real-time wallet profit and loss (PnL) statistics. Subscription Format
Parameters
string
required
Blockchain name, e.g., sol
string
required
Wallet address
string
Optional filter condition using Google Common Expression Language (CEL) syntax. Example: buyAmount > 1000
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names for better code readability.

Wallet PnL Data (Wallet Level)

Get real-time wallet overall profit and loss statistics. Subscription Format
Parameters
string
required
Blockchain name, e.g., sol
string
required
Wallet address
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names for better code readability.

Trade Series

Token Trade

Get real-time token trading events. Subscription Format
Parameters
string
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
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

Wallet Trade

Get real-time wallet trading event. Subscription Format
Parameters
string
required
Blockchain name, e.g., sol
string
required
Token contract address, e.g., GDekof7TtgeBKJtoVpkvzPin5mvhxSDyoUY2c1FK1T3i
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names to improve code readability.

DexPool Series

DEX Pool Balance

Get real-time DEX pool balance information. Subscription Format
Parameters
string
required
Blockchain name, e.g., sol
string
required
Pool address
Response Data Format
WebSocket API returns shortened field names to optimize transmission efficiency, while SDK returns full field names for better code readability.

Usage Examples

Reconnection Strategy

Recommended to use exponential backoff for reconnection:

Usage Limits

Best Practices

  1. Connection Management
    • Maintain a single WebSocket connection
    • Implement automatic reconnection
    • Send regular heartbeats
  2. Error Handling
    • Implement complete error handling
    • Log detailed error information
    • Use exponential backoff for reconnection
  3. Performance Optimization
    • Control subscription quantity
    • Implement message queue mechanism
    • Clean up unused subscriptions

Complete Example