Skip to main content
Get depth data

Pushing Rules

  1. No user login required
  2. After subscribing, then the changes will be pushed

Request

Request
Message Format: {"action":"subscribe","args":["<channel:symbol><@speed>"]}
  • actions: subscribe
  • channel: Channel name, such as futures/depth20
  • symbol: Trading pair, such as BTCUSDT
  • speed: Update speed, support 200ms or 100ms

Parameters Channel Name List

Response

Response
Return data description: Instruction Description of the depths details field:

【Public】Depth-All Channel

Return depth data, each push is the full data

Pushing Rules

  1. No user login required
  2. After subscribing, then the changes will be pushed

Request

Request
Message Format: {"action":"subscribe","args":["<channel:symbol><@speed>"]}
  • channel: Channel name, such asfutures/depthAll20
  • symbol: Trading pair, such asBTCUSDT
  • speed: Update speed, support 200ms or 100ms
Parameters Channel Name List

Response

Response
Return data description: Instruction Description of the asks bids details field:

【Public】Depth-Increase Channel

Return depth data, support the creation of a local full depth cache data

Pushing Rules

  1. No user login required
  2. After subscribing, the current data will be returned directly, and then the changes will be pushed

Request

Subscribe Request
Full depth snapshot data Request
Message Format: {"action":"<op>","args":["<channel:symbol><@speed>"]}
  • op: subscribe=Subscribe, You will receive a message that the subscription is successful, and then you will receive incremental depth data pushed in real time. request=Single request for the latest depth snapshot, You will receive a full depth of data immediately.
  • channel:Channel name, such as futures/depthIncrease20
  • symbol: Trading pair, such as BTCUSDT
  • speed: Update speed, support 200ms or 100ms
Parameters Channel Name List

Response

Full depth snapshot data
Incremental depth data
Return data description: Instruction Description of the asks bids details field:

How to correctly maintain a copy of OrderBook locally:

  1. First, the client send a subscription request {"action": "subscribe", "args": ["futures/depthIncrease20:<symbol>"] }
  2. After successful subscription, you will receive two types of messages, type=snapshot(full data)和type=update(update)
  3. If a type=snapshot type message is received, update the deep snapshot content to thelocal cache. If there is no local cache, create one.
  4. If a type=update message is received, update the data in the deep snapshot to local cache. The update rules are as follows:
    • 4.1 If the field version number in the received new message is less than or equal to the version in the local cache(new version<=local version), this data can be discarded.
    • 4.2 If the field version number in the new message received is equal to the version in the local cache plus 1(new version==local version+1), the quantity of the corresponding price will be updated to the local cache.
    • 4.3 If the field version number in the new message received is greater than the version in the local cache plus 1(new version>local version+1), please obtain the latest depth snapshot from step 7 and overwrite the local cache.
  5. The pending order volume in each returned message represents the absolute value of the current pending order volume at this price, rather than the relative change.
  6. How to update local cache? Under the premise of 4.2:
    • 6.1 New: If the same price is not already in the local cache, it means that it is a new pending order and needs to be added to the cache.
    • 6.2 Modify or Remove: If the same price is already in the local cache, it means that the quantity has changed. If the quantity is 0, it will be directly removed from the cache. Otherwise, just change the quantity.
  7. Request through request {"action": "request", "args": ["futures/depthIncrease20:<symbol>"] } to obtain the latest depth snapshot (type=snapshot in the message), and add the depth The content in the snapshot is overwritten to the local cache, and then the logic continues from step 2.
  • Abnormal Situation:
    1. Because the depth snapshot has a limit on the number of price tiers, price tiers outside the initial snapshot and without quantity changes will not appear in the incremental depth update information. Therefore, even if all updates from the incremental depth are applied, these price brackets will not be visible in the local order book, so there may be some differences between the local order book and the real order book.

【Public】Individual Symbol Book Ticker Channel

Pushes any update to the best bid or ask’s price or quantity in real-time for a specified symbol

Pushing Rules

  1. No user login required
  2. After subscribing, then the changes will be pushed
  3. Real-time push

Request

Request
Message Format: {"action":"subscribe","args":["<channel:symbol>"]}
  • actions: subscribe
  • channel: Channel name, such as futures/bookticker
  • symbol: Trading pair, such as BTCUSDT

Response

Response
Return data description: