Skip to content

Data Format

WebSocket quote push uses JSON messages. The client should first distinguish message types by the top-level type field, then parse the specific quote data by symbol and data.

INFO

Under different markets, categories, and quote permissions, fields may be omitted, set to 0, be empty strings, or only return part of an array. The client should parse compatibly: ignore unknown fields, null-check optional fields, and do not assume all messages contain the same set of fields.

Common Message Structure

Most symbol-level quote pushes use the following structure:

json
{
  "type": "QUOTE",
  "symbol": "US.AAPL",
  "data": {}
}
FieldTypeDescription
typestringPush message type, e.g. QUOTE, ORDER_BOOK, TICKER, KLINE.
symbolstringSymbol code in the format {market}.{code}, e.g. HK.00700, US.AAPL. Some market-level messages do not have this field.
dataobjectPush data body. The structure differs by type.

Recommended dispatch flow for the client:

text
Receive WebSocket message
-> JSON decode
-> switch message.type
 -> QUOTE: parse basic quote
 -> ORDER_BOOK: parse order book
 -> TICKER: parse ticker
 -> KLINE: parse K-line
 -> BROKER_QUEUE: parse broker queue
 -> MARKET_STATE: parse market state
 -> default: log and ignore

Message Types

typeDescriptionSymbol-bound
QUOTEBasic quote.Yes
ORDER_BOOKOrder book.Yes
TICKERTicker.Yes
KLINECurrent K-line.Yes
BROKER_QUEUEBroker queue.Yes
MARKET_STATEMarket state.No

BROKER_QUEUE and MARKET_STATE are usually pushed by the server based on the subscribed symbols, market, and permissions; the client does not need to pass in the corresponding subscription field separately.

Time and Values

TypeConvention
TimestampWhen a field name ends with _ms, it usually represents a Unix millisecond timestamp.
PriceUses decimal numeric values. For display, handle precision according to market conventions.
VolumeUses numeric types. Units may differ across markets; display according to market rules.
AmountTurnover and trade amount fields use numeric types.
Booleane.g. suspension indicates whether trading is suspended.
Enume.g. direction, type, status use string enums.

QUOTE Basic Quote

Basic quote pushes the real-time price and status information of a symbol.

Example

json
{
  "type": "QUOTE",
  "symbol": "US.AAPL",
  "data": {
    "data_time_ms": 1710000000000,
    "last_price": 180.12,
    "open_price": 178.5,
    "high_price": 181.2,
    "low_price": 177.9,
    "prev_close_price": 179.66,
    "volume": 12345678,
    "turnover": 2223456789.12,
    "suspension": false,
    "sec_status": "NORMAL"
  }
}

Field Description

FieldTypeDescription
data.data_time_msintegerQuote data time, Unix millisecond timestamp.
data.last_pricenumberLast price.
data.open_pricenumberOpen price.
data.high_pricenumberHigh price.
data.low_pricenumberLow price.
data.prev_close_pricenumberPrevious close price.
data.volumenumberVolume.
data.turnovernumberTurnover.
data.suspensionbooleanWhether trading is suspended.
data.sec_statusstringSecurity status.
data.option_dataobjectOption-related fields. Only applies to option categories.
data.pre_marketobjectPre-market quote fields. Only returned in applicable markets and sessions.
data.after_marketobjectAfter-market quote fields. Only returned in applicable markets and sessions.
data.overnightobjectOvernight session quote fields. Only returned in applicable markets and sessions.
data.future_dataobjectFutures-related fields. Only applies to futures categories.

TIP

QUOTE fields are semantically aligned with the Quote basic quote of the REST Real-time Quote. To obtain the complete current state in one call, use the REST API for backfill.

ORDER_BOOK Order Book

Order book pushes the real-time order book list of a symbol. The number of levels returned is determined jointly by the market, category, and the user's quote permission level (LV1/LV2/LV3).

Example

json
{
  "type": "ORDER_BOOK",
  "symbol": "HK.00700",
  "data": {
    "data_time_ms": 1710000000000,
    "ask_list": [
      {
        "price": 320.2,
        "volume": 1000,
        "order_count": 3
      }
    ],
    "bid_list": [
      {
        "price": 320.0,
        "volume": 800,
        "order_count": 2
      }
    ]
  }
}

Field Description

FieldTypeDescription
data.data_time_msintegerOrder book data time, Unix millisecond timestamp.
data.ask_listobject[]Ask list, sorted by level.
data.bid_listobject[]Bid list, sorted by level.
data.ask_list[].pricenumberAsk price.
data.ask_list[].volumenumberAsk volume.
data.ask_list[].order_countnumberNumber of orders at this level.
data.ask_list[].mpidstringMarket maker or broker identifier. Only returned for some markets or depth quotes.
data.bid_list[].pricenumberBid price.
data.bid_list[].volumenumberBid volume.
data.bid_list[].order_countnumberNumber of orders at this level.
data.bid_list[].mpidstringMarket maker or broker identifier. Only returned for some markets or depth quotes.

INFO

Both regular and depth order books use the ORDER_BOOK message type. The client should determine the display based on the actual returned levels, fields, and user permissions.

TICKER Ticker

Ticker pushes the trade details of a symbol. The server may merge multiple trades into the ticker_list of the same message.

Example

json
{
  "type": "TICKER",
  "symbol": "US.AAPL",
  "data": {
    "ticker_list": [
      {
        "time_ms": 1710000000123,
        "sequence": 123456,
        "direction": "BUY",
        "price": 180.12,
        "volume": 100,
        "turnover": 18012,
        "type": "NORMAL"
      }
    ]
  }
}

Field Description

FieldTypeDescription
data.ticker_listobject[]Ticker list.
data.ticker_list[].time_msintegerTrade time, Unix millisecond timestamp.
data.ticker_list[].sequenceintegerTrade sequence. Can be used for deduplication or sorting.
data.ticker_list[].directionstringTrade direction. Common values: BUY, SELL, NEUTRAL.
data.ticker_list[].pricenumberTrade price.
data.ticker_list[].volumenumberTrade volume.
data.ticker_list[].turnovernumberTurnover.
data.ticker_list[].typestringTrade type, e.g. NORMAL, AUTO_MATCH, ODD_LOT, AUCTION.

TIP

Do not assume a TICKER message contains only a single trade. Highly active symbols may push multiple trades in a batch; for rendering, the client is recommended to throttle and merge increments.

KLINE Current K-line

K-line pushes updates for the current period. The subscription dimension is determined by symbol + period + adjust.

Example

json
{
  "type": "KLINE",
  "symbol": "US.AAPL",
  "data": {
    "period": "1m",
    "adjust": "none",
    "kl_list": [
      {
        "time_ms": 1710000000000,
        "open_price": 180.0,
        "high_price": 180.5,
        "low_price": 179.8,
        "close_price": 180.12,
        "volume": 12345,
        "turnover": 2223456.78
      }
    ]
  }
}

Field Description

FieldTypeDescription
data.periodstringK-line period, e.g. 1m, 5m, 1D.
data.adjuststringAdjustment method, e.g. none, forward_exclude_dividend.
data.kl_listobject[]K-line list. Usually contains the currently updated K-line.
data.kl_list[].time_msintegerK-line time, Unix millisecond timestamp.
data.kl_list[].open_pricenumberOpen price.
data.kl_list[].high_pricenumberHigh price.
data.kl_list[].low_pricenumberLow price.
data.kl_list[].close_pricenumberClose price or current last price.
data.kl_list[].volumenumberVolume.
data.kl_list[].turnovernumberTurnover.
data.kl_list[].settle_pricenumberSettlement price. Only returned for some categories such as futures.

Common Periods

PeriodDescription
1m1 minute
3m3 minutes
5m5 minutes
10m10 minutes
15m15 minutes
30m30 minutes
60m60 minutes
120m120 minutes
180m180 minutes
240m240 minutes
1DDaily K
1WWeekly K
1MMonthly K
1QQuarterly K
1YYearly K

Some markets or categories may support extended periods such as pre/post-market, dark pool, or overnight sessions. Availability is subject to the actual subscription response and permissions.

BROKER_QUEUE Broker Queue

Broker queue is mainly used in some Hong Kong Stock order book scenarios and represents the broker queue corresponding to the order book.

Example

json
{
  "type": "BROKER_QUEUE",
  "symbol": "HK.00700",
  "data": {
    "data_time_ms": 1710000000000,
    "ask_brokers": [
      {
        "rank": 1,
        "broker_id": "8465",
        "broker_name": "Broker A"
      }
    ],
    "bid_brokers": [
      {
        "rank": 1,
        "broker_id": "8465",
        "broker_name": "Broker A"
      }
    ]
  }
}

Field Description

FieldTypeDescription
data.data_time_msintegerData time, Unix millisecond timestamp.
data.ask_brokersobject[]Ask broker queue.
data.bid_brokersobject[]Bid broker queue.
data.ask_brokers[].rankintegerRank.
data.ask_brokers[].broker_idstringBroker ID.
data.ask_brokers[].broker_namestringBroker name; may be omitted.
data.bid_brokers[].rankintegerRank.
data.bid_brokers[].broker_idstringBroker ID.
data.bid_brokers[].broker_namestringBroker name; may be omitted.

BROKER_QUEUE is not passed in as a regular subscription request field; it is usually returned at the server's discretion based on the subscribed order book capability, market, and permissions.

MARKET_STATE Market State

Market state is a market-level message and is not bound to a single symbol, so it usually has no symbol field.

Example

json
{
  "type": "MARKET_STATE",
  "data": {
    "market": "US",
    "status": "OPEN",
    "trade_date": "2024-03-08"
  }
}

Field Description

FieldTypeDescription
data.marketstringMarket identifier, e.g. US, HK.
data.statusstringMarket trading status.
data.trade_datestringTrade date.

Upon receiving MARKET_STATE, the client can use it to update market open/close status, trade date hints, or subscription data availability hints on the page.

Compatibility Recommendations

  • Dispatch by type: Different message structures vary significantly; do not parse all pushes with a single strongly-typed model.
  • Ignore unknown fields: The server may add fields; the client should remain forward-compatible.
  • Tolerate unknown type: Log and skip to avoid breaking connection handling when new message types are introduced.
  • Null-check optional fields: Option, futures, pre/post-market, overnight, and broker queue fields are only returned in applicable scenarios.
  • Treat arrays as possibly empty: ask_list, bid_list, ticker_list, kl_list, and other arrays may be empty.
  • Backfill after disconnect: Push is for real-time updates. After a disconnect, reconnect, or parse failure, use the REST real-time quote API to retrieve the latest state.