SUBSCRIBE Orderbook

SUB wss://test-api.synquote.com/ws

Receive notifications about changes to the order book for a certain instrument.

SUBSCRIBE

HEADER PARAMS

msg_type string required
Message type: add_subscriptions

id number required
The ID of the request. This is returned in the response header.

version integer required
Version number: 1

BODY PARAMS

channel array of strings required
market_data.orderbook_updates.{instrument_id}
Wildcards are supported, e.g. market_data.orderbook_updates.* can be used to receive notifications about all instruments

Example
[
  {
    "msg_type": "add_subscriptions",
    "id": 1002,
    "version": 1
  },
  {
    "channels": ["market_data.orderbook_updates.ETH-PERPETUAL"]
  }
]

NOTIFICATION

is_initial_snapshot boolean
If true, this notification contains the initial snapshot of the entire orderbook.

asksarray of array of strings
changestring
pricestring
sizestring
bidsarray of array of strings
pricestring
sizestring

market_seqno string
If is_initial_snapshot, it's the latest sequence number corresponding to the snapshot, otherwise it's the sequence number for the orderbook update. A monotonic sequence number updated for each book event. e.g. a fill, cancel, etc.

transaction_ts string
The time the order book update occurred in UNIX epoch nanoseconds.

Example
[
  {
    "id": 74263,
    "msg_type": "market_data.orderbook_updates.ETH-PERPETUAL",
    "version": 1
  },
  {
    "asks": [],
    "bids": [["3815.5", "498.1"]],
    "is_initial_snapshot": false,
    "market_seqno": 123456,
    "transaction_ts": "1726080879628498287"
  }
]

Behavior

The first notification will contain a snapshot of the entire order book, all following notifications will contain only price levels that have changed.

  • is_initial_snapshot: Set to true, indicating this is the initial view of the book.
  • transaction_ts: The time the order book update occurred in UNIX epoch nanoseconds. If is_initial_snapshot is true, it is the time of the most recent order book update.
  • bids/asks: An array detailing changes to the bid/ask side of the book. The array may be empty if no changes occurred, but at least one side (bid or ask) will have changes. Each entry includes an array containing two strings with the following values:
    • 1 (Price): Listed in decreasing order for bids and increasing order for asks.
    • 2 (Size): Total tradable size of all orders at this price level.