Skip to main content

Orderbook

Get different depth

Covers: USDT Perpetual, USDC Perpetual, Inverse Perpetual, Inverse Future, Option

info
  • Once subscribe successfully, you will receive a snapshot first.
  • For snapshot stream, it is sort by order price, which bids is from highest to lowest and asks is from lowest to highest
  • Websocket will keep pushing delta message when orderbook is changed.
  • If you receive a new snapshot data, it is necessary to reset your local orderbook.
  • If there is a problem in bybit end, it will re-send a snapshot, which is promised the latest and accurate.
tip

Linear & inverse level 1 data: if 3 seconds have elapsed without a change in the orderbook, a snapshot message will be pushed again.

Linear & Inverse:

  • Level 1 data, push frequency: 10ms
  • Level 50 data, push frequency: 20ms
  • Level 200 data, push frequency: 100ms
  • Level 500 data, push frequency: 100ms

Option:

  • Level 25 data, push frequency: 20ms
  • Level 100 data, push frequency: 100ms

Topic: (note: option has 25 & 100 level only)
orderbook.{depth}.{symbol} e.g., orderbook.1.BTCUSDT

Response Parameters

ParameterTypeComments
topicstringTopic name
typestringMessage type. snapshot,delta
tsnumberThe timestamp (ms) that system generates the data.
dataObject
> sStringSymbol name
> barray<array>Bid array
>> b[0][0]stringBid price
>> b[0][1]stringBid size
> sarray<array>Ask array
>> s[0][0]stringAsk price
>> s[0][1]stringAsk size
> unumberUpdate id, is always in sequence. Occasionally, you'll receive "u"=1, which is a snapshot data due to the restart of the service. So please overwrite the locally saved orderbook
> seqnumberCross sequence (internal value)

Subscription Example

{
"op": "subscribe",
"args": [
"orderbook.50.BTCUSDT"
],
"req_id": "test" // optional
}

Stream Example

{
"topic": "orderbook.50.BTCUSDT",
"type": "snapshot",
"ts": 1671179923028,
"data": {
"s": "BTCUSDT",
"b": [
[
"17440.00",
"40.833"
],
[
"17439.50",
"0.513"
],
...
[
"17416.00",
"6.156"
],
[
"17415.50",
"32.268"
]
],
"a": [
[
"17440.50",
"78.815"
],
[
"17441.00",
"8.858"
],
...
[
"17464.50",
"4.901"
],
[
"17465.00",
"5.744"
]
],
"u": 13079592,
"seq": 22520573250
}
}