Data Format
WebSocket trade event push uses JSON messages. Each push message corresponds to one trade event. Clients should first differentiate the event type using the event_type field, then parse the specific fields such as order_info and fill_infos.
INFO
Numeric fields in trade events (such as price and quantity) are transmitted as strings to avoid floating-point precision issues. Time fields use microsecond timestamps (Unix microseconds). Handle types according to field descriptions when parsing, and ignore unknown fields to maintain forward compatibility.
Message Structure
The top level of each push message is a TradeEvent object:
{
"event_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"event_type": "EVENT_FILL",
"event_time_us": 1751433600000000,
"user_info": {
"uid": 123456789,
"acc_id": 987654321098765432
},
"order_info": {
"order_id": "ORDER_001",
"side": "BUY",
"order_type": "LIMIT",
"order_status": "FILLED_ALL",
"code": "US.AAPL",
"stock_name": "Apple Inc.",
"security_type": "STOCK",
"qty": "100",
"price": "180",
"currency": "USD",
"create_time": 1751433500000000,
"updated_time": 1751433600000000,
"dealt_qty": "100",
"dealt_avg_price": "179.98",
"time_in_force": "DAY",
"session": "RTH"
},
"fill_infos": [
{
"side": "BUY",
"deal_id": "DEAL_001",
"order_id": "ORDER_001",
"code": "US.AAPL",
"stock_name": "Apple Inc.",
"qty": "100",
"price": "179.98",
"create_time": 1751433600000000,
"updated_time": 1751433600000000,
"status": "OK"
}
]
}TradeEvent Top-Level Fields
| Field | Type | Description |
|---|---|---|
event_id | string | Unique event ID (UUID). Can be used for client-side idempotent handling. |
event_type | string | Event type. See the event type table below. |
event_time_us | integer | Event occurrence time, Unix microsecond timestamp. |
user_info | object | User information. See user_info Fields. |
order_info | object | Order information. See order_info Fields. |
fill_infos | object[] | Fill information list. See fill_infos Fields. Only populated for EVENT_FILL, EVENT_FILL_CORRECT, and EVENT_FILL_CANCEL events; this field is an empty array for all other events. |
Event Types
Possible values of the event_type field:
| Value | Description |
|---|---|
EVENT_NEW | Order placed successfully. The order has been accepted by the exchange or system. |
EVENT_REPLACED | Order modified successfully. The order price or quantity has been updated. |
EVENT_CANCELED | Order cancelled successfully. The order has been cancelled. |
EVENT_EXPIRED | Order expired. The order was cancelled by the system when its time-in-force expired. |
EVENT_FILL | Fill event. fill_infos contains the fill details for this event; may be a partial fill or full fill. |
EVENT_NEW_REJECTED | Order placement rejected. The order was rejected; the rejection reason is in last_err_msg. |
EVENT_REPLACE_REJECTED | Order modification rejected. The modification request was rejected; the rejection reason is in last_err_msg. |
EVENT_CANCEL_REJECTED | Order cancellation rejected. The cancellation request was rejected; the rejection reason is in last_err_msg. |
EVENT_FILL_CORRECT | Fill correction. An existing fill has been corrected. fill_infos contains the corrected fill details; the status of the corrected fill is CHANGED. |
EVENT_FILL_CANCEL | Fill cancellation. An existing fill has been cancelled by the system; the status of the fill in fill_infos is CANCELLED. |
user_info Fields
| Field | Type | Description |
|---|---|---|
uid | integer | User ID (nnid). |
acc_id | integer | Long business account ID. If the same user holds multiple trading accounts, use this field to distinguish the source account of each event. |
order_info Fields
| Field | Type | Description |
|---|---|---|
order_id | string | Order ID. |
side | string | Trade direction. See trd_side. |
order_type | string | Order type. See order_type. |
order_status | string | Order status. See order_status. |
code | string | Security code in the format {exchange}.{symbol}, e.g. US.AAPL, SEHK.00700. |
stock_name | string | Security name. |
security_type | string | Security type. See security_type. |
qty | string | Order quantity. |
price | string | Order price. May be empty for market orders. |
currency | string | Trading currency. See currency. |
create_time | integer | Order creation time, Unix microsecond timestamp. |
updated_time | integer | Order last updated time, Unix microsecond timestamp. |
dealt_qty | string | Filled quantity. |
dealt_avg_price | string | Average fill price. Empty if no fills. |
last_err_msg | string | Most recent failure description. Only populated for EVENT_NEW_REJECTED, EVENT_REPLACE_REJECTED, EVENT_CANCEL_REJECTED, and similar failure events. |
remark | string | Remark provided at order placement. |
time_in_force | string | Time-in-force type. See time_in_force. |
session | string | Trading session. See trading_session. |
aux_price | string | Conditional order trigger price. Only applicable to conditional order types such as STOP, STOP_LIMIT, MARKET_IF_TOUCHED, LIMIT_IF_TOUCHED. |
trail_type | string | Trailing stop type. See trail_type. Only applicable to TRAILING_STOP and TRAILING_STOP_LIMIT types. |
trail_value | string | Trailing amount or percentage. Only applicable to trailing stop types. |
trail_spread | string | Specified spread. Only applicable to TRAILING_STOP_LIMIT type. |
multi_leg_info | object | Multi-leg order information. See multi_leg_info Fields. Only applicable to multi-leg option orders where security_type is MULTILEG_OPTION. |
fill_infos Fields
| Field | Type | Description |
|---|---|---|
side | string | Trade direction. See trd_side. |
deal_id | string | Fill ID. Base58-encoded, up to 32 characters. Case-sensitive. |
order_id | string | Order ID, corresponding to order_info.order_id. |
code | string | Security code in the format {exchange}.{symbol}. |
stock_name | string | Security name. |
qty | string | Fill quantity. |
price | string | Fill price. |
create_time | integer | Fill creation time, Unix microsecond timestamp. |
updated_time | integer | Fill last updated time, Unix microsecond timestamp. |
counter_broker_id | integer | Counterparty broker ID. |
counter_broker_name | string | Counterparty broker name. |
status | string | Fill status. See deal_status. |
multi_leg_info Fields
Additional information for multi-leg option orders. Only present when order_info.security_type is MULTILEG_OPTION.
| Field | Type | Description |
|---|---|---|
underlying_symbol | string | Underlying instrument code. |
underlying_stock_name | string | Underlying instrument name. |
leg_infos | object[] | List of individual leg order information. See leg_infos Fields. |
leg_infos Fields
Information for a single leg in a multi-leg option order.
| Field | Type | Description |
|---|---|---|
symbol | string | Security code for this leg. |
exchange | string | Exchange for this leg. See exchange. |
ratio_qty | string | Ratio of this leg under greatest common divisor normalization. |
side | string | Trade direction for this leg. See trd_side. |
security_type | string | Security type for this leg. See security_type. |
stock_name | string | Security name for this leg. |
hp_multiplier | string | Contract multiplier for this leg. |
avg_fill_price | string | Average fill price for this leg. |
Compatibility Recommendations
- Dispatch by
event_type: Whetherfill_infosis populated varies significantly by event type — use switch/match handling. - Ignore unknown fields: The server may add new fields; clients should maintain forward compatibility.
- Handle unknown
event_typevalues gracefully: Log and skip unknown event types to avoid processing errors when new event types are introduced. - Parse numeric fields as strings: Price, quantity, and similar fields are all strings — convert to Decimal or float as needed to handle precision correctly.
- Microsecond timestamps:
event_time_us,create_time, andupdated_timeare all Unix microsecond timestamps — distinguish these from millisecond timestamps.