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",
    "position_open_type": "",
    "algo_info": null
  },
  "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.
EVENT_WAIT_OPENOrder parked event.
EVENT_PRICE_PROTECTOrder price protection event.
EVENT_TRIGGER_WAITINGConditional order monitoring event.
EVENT_TRIGGERConditional order triggered event.

user_info Fields ​

FieldTypeDescription
uidintegerUser ID (nnid).
acc_idintegerLong business account ID. This is the same business account as the REST path acc_id. The JSON value is a number; do not parse it with JavaScript Number when it exceeds the safe integer range.

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.
exchangestringExchange the security is listed on (e.g. SEHK, COMEX). Sent alongside code.
expire_timeintegerOrder expiry time, Unix microsecond timestamp.
sub_acc_idstringJP sub-account ID. Only applicable to JP accounts.
margin_trading_typestringJP margin trading type (GENERAL / STANDARDIZED). Only applicable to JP margin accounts.
margin_period_typestringJP margin period (INDEFINITE). Only applicable to JP margin accounts.
position_open_typestringPosition open type (for trailing stop orders): DISABLE_POSITION_OPEN / ENABLE_POSITION_OPEN.
algo_infoobjectAlgo order parameters. null for non-algo orders. See algo_info Fields.

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_idstringCounterparty broker ID.
counter_broker_namestringCounterparty broker name.
statusstringFill status. See deal_status.
sub_acc_idstringJP sub-account ID. Only applicable to JP accounts.

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
codestringLeg code. Format: market.symbol (same as leg_code on the order placement / order detail side).
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.

algo_info Fields ​

Algo order parameters. Only populated for algo orders; null for non-algo orders.

FieldTypeDescription
start_timeintegerStart execution time, Unix microsecond timestamp.
end_timeintegerEnd execution time, Unix microsecond timestamp.
pricing_strategystringSub-order pricing strategy: ADAPTIVE / GHOST / PASSIVE.
layeringstringSub-order layering: AUTO / 1–10.
twapobjectTWAP parameters. See twap Fields.
vwapobjectVWAP parameters. See vwap Fields.
povobjectPOV parameters. See pov Fields.
slicerobjectSlicer parameters. See slicer Fields.
pegobjectPEG parameters. See peg Fields.
icebergobjectIceberg parameters. See iceberg Fields.

twap Fields ​

FieldTypeDescription
participation_ratestringMax participation rate, 1%–99%.

vwap Fields ​

FieldTypeDescription
participation_ratestringMax participation rate, 1%–99%.

pov Fields ​

FieldTypeDescription
participation_ratestringMax participation rate.

slicer Fields ​

FieldTypeDescription
slice_intervalintegerSub-order interval (seconds), ≥ 10.
display_qtyintegerSub-order single placement quantity (lots).
display_qty_varintegerQuantity randomization, 0–99.

peg Fields ​

FieldTypeDescription
display_qtyintegerSub-order single placement quantity (lots).
peg_offsetstringPegged offset position.
display_qty_varintegerQuantity randomization, 0–99.

iceberg Fields ​

FieldTypeDescription
display_qtyintegerSub-order single placement quantity (lots).
display_qty_varintegerQuantity randomization, 0–99.

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 (orders and fills) are all Unix microsecond timestamps — distinguish these from millisecond timestamps.