Skip to content

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:

json
{
  "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 ​

FieldTypeDescription
event_idstringUnique event ID (UUID). Can be used for client-side idempotent handling.
event_typestringEvent type. See the event type table below.
event_time_usintegerEvent occurrence time, Unix microsecond timestamp.
user_infoobjectUser information. See user_info Fields.
order_infoobjectOrder information. See order_info Fields.
fill_infosobject[]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:

ValueDescription
EVENT_NEWOrder placed successfully. The order has been accepted by the exchange or system.
EVENT_REPLACEDOrder modified successfully. The order price or quantity has been updated.
EVENT_CANCELEDOrder cancelled successfully. The order has been cancelled.
EVENT_EXPIREDOrder expired. The order was cancelled by the system when its time-in-force expired.
EVENT_FILLFill event. fill_infos contains the fill details for this event; may be a partial fill or full fill.
EVENT_NEW_REJECTEDOrder placement rejected. The order was rejected; the rejection reason is in last_err_msg.
EVENT_REPLACE_REJECTEDOrder modification rejected. The modification request was rejected; the rejection reason is in last_err_msg.
EVENT_CANCEL_REJECTEDOrder cancellation rejected. The cancellation request was rejected; the rejection reason is in last_err_msg.
EVENT_FILL_CORRECTFill correction. An existing fill has been corrected. fill_infos contains the corrected fill details; the status of the corrected fill is CHANGED.
EVENT_FILL_CANCELFill cancellation. An existing fill has been cancelled by the system; the status of the fill in fill_infos is CANCELLED.

user_info Fields ​

FieldTypeDescription
uidintegerUser ID (nnid).
acc_idintegerLong 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 ​

FieldTypeDescription
order_idstringOrder ID.
sidestringTrade direction. See trd_side.
order_typestringOrder type. See order_type.
order_statusstringOrder status. See order_status.
codestringSecurity code. Format: market.symbol, e.g. US.AAPL, HK.00700.
stock_namestringSecurity name.
security_typestringSecurity type. See security_type.
qtystringOrder quantity.
pricestringOrder price. May be empty for market orders.
currencystringTrading currency. See currency.
create_timeintegerOrder creation time, Unix microsecond timestamp.
updated_timeintegerOrder last updated time, Unix microsecond timestamp.
dealt_qtystringFilled quantity.
dealt_avg_pricestringAverage fill price. Empty if no fills.
last_err_msgstringMost recent failure description. Only populated for EVENT_NEW_REJECTED, EVENT_REPLACE_REJECTED, EVENT_CANCEL_REJECTED, and similar failure events.
remarkstringRemark provided at order placement.
time_in_forcestringTime-in-force type. See time_in_force.
sessionstringTrading session. See trading_session.
aux_pricestringConditional order trigger price. Only applicable to conditional order types such as STOP, STOP_LIMIT, MARKET_IF_TOUCHED, LIMIT_IF_TOUCHED.
trail_typestringTrailing stop type. See trail_type. Only applicable to TRAILING_STOP and TRAILING_STOP_LIMIT types.
trail_valuestringTrailing amount or percentage. Only applicable to trailing stop types.
trail_spreadstringSpecified spread. Only applicable to TRAILING_STOP_LIMIT type.
multi_leg_infoobjectMulti-leg order information. See multi_leg_info Fields. Only applicable to multi-leg option orders where security_type is MULTILEG_OPTION.

fill_infos Fields ​

FieldTypeDescription
sidestringTrade direction. See trd_side.
deal_idstringFill ID. Base58-encoded, up to 32 characters. Case-sensitive.
order_idstringOrder ID, corresponding to order_info.order_id.
codestringSecurity code. Format: market.symbol, e.g. US.AAPL, HK.00700.
stock_namestringSecurity name.
qtystringFill quantity.
pricestringFill price.
create_timeintegerFill creation time, Unix microsecond timestamp.
updated_timeintegerFill last updated time, Unix microsecond timestamp.
counter_broker_idintegerCounterparty broker ID.
counter_broker_namestringCounterparty broker name.
statusstringFill 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.

FieldTypeDescription
underlying_symbolstringUnderlying instrument code.
underlying_stock_namestringUnderlying instrument name.
leg_infosobject[]List of individual leg order information. See leg_infos Fields.

leg_infos Fields ​

Information for a single leg in a multi-leg option order.

FieldTypeDescription
symbolstringSecurity code for this leg.
exchangestringExchange for this leg. See exchange.
ratio_qtystringRatio of this leg under greatest common divisor normalization.
sidestringTrade direction for this leg. See trd_side.
security_typestringSecurity type for this leg. See security_type.
stock_namestringSecurity name for this leg.
hp_multiplierstringContract multiplier for this leg.
avg_fill_pricestringAverage fill price for this leg.

Compatibility Recommendations ​

  • Dispatch by event_type: Whether fill_infos is 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_type values 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, and updated_time are all Unix microsecond timestamps — distinguish these from millisecond timestamps.