Market Data Push
Overview
Market data push uses WebSocket V2 subscription endpoint, supporting real-time market data push including orderbook, K-line, and quote statistics.
Connection Information
Connection Endpoint: wss://{host}/ws/v2/stream
Description: WebSocket V2 subscription endpoint, supporting multiple data type subscriptions
Authentication: Institution credentials (API Key + Signature), passed via api_key, timestamp, and signature fields in each message. See WebSocket Authentication
Subscription Request
To subscribe to market data, send a JSON message in the following format:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"method": "market",
"action": "subscribe",
"params": {
"type": "orderbooks",
"tickers": ["AAPLs@usex"]
},
"api_key": "<your-api-key>",
"timestamp": "1703123456789",
"signature": "<computed-signature>"
}Note: Each message must carry
api_key,timestamp, andsignaturefor authentication. For signature calculation details, see WebSocket Authentication.
Parameter Description
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Request unique identifier, recommended to use UUID |
| method | string | Yes | Fixed value market |
| action | string | Yes | subscribe or unsubscribe |
| params | object | Yes | Subscription parameters |
| params.type | string | Yes | Data type: orderbooks, kline, quote |
| params.tickers | array | Yes | List of tickers to subscribe |
| api_key | string | Yes | Institution API key |
| timestamp | string | Yes | Unix timestamp in milliseconds |
| signature | string | Yes | Request signature. Set as empty string placeholder during signature calculation |
Supported Data Types
| Type | Description |
|---|---|
orderbooks | Real-time orderbook data |
kline | Real-time K-line (1 minute) |
quote | Real-time quote statistics |
The chain-denominated types (router_quote, router_price) belong to the Instant Swap API — see Market Data Push (Instant Swap API).
Tickers Format
- Format:
symbol@market - Market: Market code. See
Marketenum type description - Example:
AAPLs@usex
Server Response
Each subscription or unsubscription request receives a corresponding response:
Success Response:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"success": true
}Error Response:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"success": false,
"message": "Invalid params for method: market"
}| Field | Type | Description |
|---|---|---|
| id | UUID / null | Corresponding request ID, may be null on parse failure |
| success | boolean | Whether the request succeeded |
| message | string | Error description when failed, absent on success |
Data Push
Orderbook Data Push
When subscribing to orderbooks type, you will receive orderbook data push in the following format:
{
"type": "orderbook",
"data": {
"symbol": "AAPLs",
"market": "usex",
"time": "2025-09-25 10:10:23.394",
"ask": [
{ "price": 710, "volume": 100 },
{ "price": 711, "volume": 200 }
],
"bid": [
{ "price": 709.99, "volume": 110 },
{ "price": 708.5, "volume": 50 }
]
}
}| Field | Type | Description |
|---|---|---|
| type | string | Fixed as "orderbook" |
| data | object | Orderbook data |
| data.symbol | string | Ticker code |
| data.market | string | Market code. See Market enum type description |
| data.time | string | Orderbook data time |
| data.ask | object[] | Ask list, sorted by price in ascending order |
| data.ask[].price | decimal | Ask price |
| data.ask[].volume | decimal | Ask volume |
| data.bid | object[] | Bid list, sorted by price in descending order |
| data.bid[].price | decimal | Bid price |
| data.bid[].volume | decimal | Bid volume |
K-line Data Push
When subscribing to kline type, you will receive K-line data push in the following format:
{
"type": "kline",
"data": {
"symbol": "AAPLs",
"time": "2025-05-30 15:50:00",
"open": 498.6,
"high": 598.6,
"low": 398.6,
"close": 498.6,
"volume": 125,
"turnover": 56873.25
}
}| Field | Type | Description |
|---|---|---|
| type | string | Message type, fixed value kline |
| data | object | K-line data |
| data.symbol | string | Ticker code |
| data.time | string | K-line time (start time of the minute) |
| data.open | decimal | Opening price |
| data.high | decimal | Highest price |
| data.low | decimal | Lowest price |
| data.close | decimal | Closing price |
| data.volume | decimal | Trading volume |
| data.turnover | decimal | Trading turnover |
Push Frequency: Pushed once per minute, at the end of each minute, sending the complete K-line data for that minute.
Quote Statistics Data Push
When subscribing to quote type, you will receive quote statistics data push in the following format:
{
"type": "quote",
"data": {
"symbol": "AAPLs",
"time": "2025-05-30 15:58:17",
"session": "trading",
"open": 506,
"high": 606.5,
"low": 396,
"close": 498.4,
"volume": 125,
"turnover": 708234.56
}
}| Field | Type | Description |
|---|---|---|
| type | string | Message type, fixed value quote |
| data | object | Quote statistics data |
| data.symbol | string | Ticker code |
| data.time | string | Current market data time |
| data.session | string | Trading session (trading, pre_market, after_market, etc.) |
| data.open | decimal | Opening price |
| data.high | decimal | Highest price |
| data.low | decimal | Lowest price |
| data.close | decimal | Closing price |
| data.volume | decimal | Trading volume |
| data.turnover | decimal | Trading turnover |
Push Frequency: Real-time push, immediately when quote changes.
Unsubscription
To unsubscribe from market data, send a JSON message in the following format:
{
"id": "550e8400-e29b-41d4-a716-446655440001",
"method": "market",
"action": "unsubscribe",
"params": {
"type": "orderbooks",
"tickers": ["AAPLs@usex"]
},
"api_key": "<your-api-key>",
"timestamp": "1703123456789",
"signature": "<computed-signature>"
}Heartbeat Mechanism
The server sends heartbeat messages every 30 seconds:
{
"type": "heartbeat",
"timestamp": 1703123456789
}Error Handling
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
Invalid JSON format | JSON format error | Check JSON syntax |
Invalid request method | Invalid method value | Use supported method |
Missing params | Missing required parameters | Provide params field |
Invalid params | Parameter format error | Check parameter structure |
Invalid or missing authentication header(s) | Institution credential authentication failed | Check api_key, timestamp, and signature |
Subscription limit reached | Throttling limit | Reduce connection count |
Error Response Example
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"success": false,
"message": "Invalid params for method: market"
}Notes
- Multiple subscription messages can be sent on the same connection, each incrementally adding subscriptions
- All subscriptions are automatically cleaned up when the connection drops
- Tickers with invalid format or unrecognized market are silently skipped