This reference lists every message of the market-data schema (ID 20) with its fields, offsets,
types, null values, and meaning. Each field shows its name, then its byte offset and type. Offsets
count from the start of the message's fixed block, after the 8-byte header; group entry offsets
count from the start of the entry. Each description starts with the field's presence and null
value, followed by the schema's own description. How to subscribe and recover is on Market data.
Null values are written by name: INT64_MIN is -9223372036854775808. A field holding its null
value is absent.
Template index
Requests are the messages you send:
Responses and stream messages are the messages the server sends:
Encoding composites
Every message starts with messageHeader, and repeating groups start with groupSizeEncoding.
The schema has no variable-length fields. All values are little-endian.
messageHeader, 8 bytes, before every message:
groupSizeEncoding, 4 bytes, before every repeating group:
Requests
Messages you send. Each carries a requestId the server echoes.
Subscribe
Template ID 1 · block length 8 bytes. Client request to subscribe to streams; answered by one SubscribeResponse with one result per item, in order.
Group items (groupSizeEncoding: uint16 entry block length, uint16 count). Streams to subscribe to.
Entry block length 5 bytes.
Unsubscribe
Template ID 2 · block length 8 bytes. Client request to end subscriptions; answered by one SubscribeResponse with one result per item, in order. No message of an unsubscribed stream follows the response.
Group items (groupSizeEncoding: uint16 entry block length, uint16 count). Streams to unsubscribe from.
Entry block length 5 bytes.
Ping
Template ID 3 · block length 8 bytes. Client liveness probe; answered by one Pong.
Responses
Answers to your requests.
SubscribeResponse
Template ID 20 · block length 8 bytes. Server answer to one Subscribe or Unsubscribe; a subscribed stream's first message follows its OK result, and an unsubscribed stream's messages end before it.
Group results (groupSizeEncoding: uint16 entry block length, uint16 count). One result per requested item, in request order.
Entry block length 6 bytes.
Pong
Template ID 21 · block length 16 bytes. Server answer to one Ping.
Stream messages
Messages of the streams you subscribed to.
Trades
Template ID 22 · block length 36 bytes. Trades of the trades stream: up to 256 fills of one book update in match order. A larger update is several messages with the same updateId. Each trade is delivered at most once per subscription; a trade that cannot be delivered is named in a TradesSkipped.
Group entries (groupSizeEncoding: uint16 entry block length, uint16 count). Trades in ascending tradeId order.
Entry block length 25 bytes.
TradesSkipped
Template ID 27 · block length 36 bytes. Trades of the trades stream that this subscription will not receive live. Recover them from the trade history API by trade identifier.
TradesThrough
Template ID 28 · block length 28 bytes. Trade frontier of the trades stream: every trade of bookEpoch with tradeId at or below lastTradeId has been delivered on this subscription or named in a TradesSkipped. Sent first on subscribe as the subscription's baseline, then every second.
BestBidOffer
Template ID 23 · block length 68 bytes. Best bid and offer of a bbo subscription, sent when the best price or quantity of either side changes and re-sent unchanged every second. Only the newest is sent to a subscriber that falls behind. Keep the message with the highest (bookEpoch, updateId); an equal pair is a re-send that confirms liveness.
DepthSnapshot
Template ID 24 · block length 39 bytes. Full replacement of the best price levels of a depth20 or depth subscription. On depth20, keep the message with the highest (bookEpoch, updateId); an equal pair is an unchanged re-send that confirms liveness. On depth, it replaces the book whatever it held, and the DepthUpdates that follow continue from its updateId.
Group bids (groupSizeEncoding: uint16 entry block length, uint16 count). Bid levels, best (highest price) first; at most levelsPerSide.
Entry block length 16 bytes.
Group asks (groupSizeEncoding: uint16 entry block length, uint16 count). Ask levels, best (lowest price) first; at most levelsPerSide.
Entry block length 16 bytes.
DepthUpdate
Template ID 25 · block length 44 bytes. Incremental update of a depth subscription's window. Apply it only to a book at exactly firstUpdateId-1 of the same bookEpoch: the previous DepthUpdate's lastUpdateId, or the DepthSnapshot's updateId. On any other position, discard the book and resubscribe (Unsubscribe, then Subscribe); never apply it to a book taken from another source or to a position inside the range. Each level is a SET of its total quantity, and quantity 0 removes the level. After applying it, truncate each side to the DepthSnapshot's levelsPerSide best levels: a level pushed out of the window by better levels is not removed on the wire.
Group bids (groupSizeEncoding: uint16 entry block length, uint16 count). Changed bid levels of the window: levels that changed inside it, entered it from below, or left it because they emptied.
Entry block length 16 bytes.
Group asks (groupSizeEncoding: uint16 entry block length, uint16 count). Changed ask levels of the window: levels that changed inside it, entered it from below, or left it because they emptied.
Entry block length 16 bytes.
MarketStatus
Template ID 26 · block length 13 bytes. Feed state of a trading pair, sent to every subscription of the pair when it changes and when a subscription starts while the pair is stale.
Enums
Side
uint8. 0 means not set. Direction of the order that took liquidity in a trade.
StreamType
uint8. Market-data stream of one trading pair.
SubscribeResult
uint8. Outcome of one subscription item.
FeedState
uint8. Whether the server holds the current state of a trading pair's market data.