Depth

Websocket channel for depth data up to 200

Description

Interval: 100ms

Notes: Initial subscription will receive the full data of bid/ask price up to 200. Every 100ms will receive the delta change, changing the quantity to the price key.

Request

{"event": "subscribe", "arg": [{ "channel": "depth", "sym":"OKX_SPOT_BTC_USDT" }]}
Field nameTypeNecessaryRemarks
eventStringYsubscribe / unsubscribe
argsArrayYSubscribe param. There can be no more than 50 sym parameters per subscribe.
> channelStringYChannel name: depth/ orderbook, depth for 200 prices, orderbook for 50 prices.
> symStringYUnique identifier

Response

{"event":"subscribe","arg":[{"channel":"depth","sym":"OKX_SPOT_BTC_USDT"}],"code":0,"message":"Success"}
FieldTypeRemarks
eventStringsubscribe / unsubscribe
codeStringError Code
msgStringError Message
argsArraySubscribe param
> channelStringChannel name: depth/ orderbook, depth for 200 prices, orderbook for 50 prices.
> symStringUnique identifier

Data Sample:

{
   "arg":{
      "channel":"depth",
      "sym":"OKX_SPOT_BTC_USDT",
      "updatetype":"update"
   },
   "data":{
      "ts":"1732092613759",
      "seq":"37947945726",
      "pre_seq":"37947945641",
      "num":433,
      "Bids":[
         [
            "93247.9",
            "0.65372274"
         ],
         [
            "93242.6",
            "0.02041334"
         ],
         [
            "93241.7",
            "0.02811836"
         ],
         [
            "93240.1",
            "0"
         ],
         [
            "93239.4",
            "0.0414241"
         ],
         [
            "93238.6",
            "0.20821136"
         ],
         [
            "93238.5",
            "0.27"
         ],
         [
            "93235.7",
            "0.21806169"
         ],
         [
            "93234.9",
            "0"
         ],
         [
            "93230.7",
            "0.10842291"
         ],
         [
            "93229.9",
            "0"
         ],
         [
            "93223.2",
            "0.17068982"
         ],
         [
            "93222.4",
            "0"
         ],
         [
            "93220.1",
            "0.385755"
         ],
         [
            "93217.5",
            "0"
         ],
         [
            "93214",
            "0.21422164"
         ],
         [
            "93200.1",
            "0"
         ],
         [
            "93198.3",
            "0"
         ],
         [
            "93189.5",
            "0"
         ],
         [
            "93177.9",
            "0.01011395"
         ],
         [
            "93171.4",
            "0"
         ],
         [
            "93167.4",
            "0"
         ],
         [
            "93136.6",
            "0.02145111"
         ],
         [
            "93135.8",
            "0.01"
         ],
         [
            "93135.2",
            "0.00001075"
         ]
      ],
      "Asks":[
         [
            "93252.2",
            "0.00005326"
         ],
         [
            "93253",
            "0.19705105"
         ],
         [
            "93253.8",
            "0.19315446"
         ],
         [
            "93256.1",
            "0.02841637"
         ],
         [
            "93256.9",
            "0.04456728"
         ],
         [
            "93258.7",
            "0.14661635"
         ],
         [
            "93259.9",
            "0.00014644"
         ],
         [
            "93260.7",
            "0.06348764"
         ],
         [
            "93264.9",
            "0.00254712"
         ],
         [
            "93265.7",
            "0.11325629"
         ],
         [
            "93272.4",
            "0"
         ],
         [
            "93272.6",
            "0.21458917"
         ],
         [
            "93273.2",
            "0.17746147"
         ],
         [
            "93274.6",
            "0"
         ],
         [
            "93275.9",
            "0.00009664"
         ],
         [
            "93289",
            "0.00001397"
         ],
         [
            "93290",
            "0.06839816"
         ],
         [
            "93291",
            "0.03"
         ],
         [
            "93296.9",
            "0"
         ],
         [
            "93297",
            "0"
         ],
         [
            "93297.2",
            "0"
         ]
      ]
   }
}
FieldTypeRemarks
> channelStringChannel name: depth/ orderbook, depth for 200 prices, orderbook for 50 prices.
> symStringUnique identifier
> updatetypeStringall / update. Initial subscription to receive all depth data, following with update data
dataArrayData
> tsStringTimestamp, in Unix millionsecond. e.g. 1732093591811
> seqStringsequence number for the current data
> pre_seqStringsequence number for the previous data
> numStringTotal pushed data times
> bidsStringBids data
> > priceStringPrices
> > qtyStringQuantity
> asksStringAsks data
> > priceStringPrices
> > qtyStringQuantity