订阅Depth数据

  • channel: babelsub_spot$pair_depth

成功建立和 WebSocket API 的连接之后,向 Server 发送如下格式的数据来订阅数据

{
  "event": "addChannel",
  "channel": "babel_sub_spot_$pair_depth"
}
参数名称是否必须类型描述默认值取值范围
pairtruestring交易对BIX_BTC, BIX_ETH, BTC_USDT, ETH_USDT......

请求 Depth 数据的例子

正确订阅

{
  "event": "addChannel",
  "channel": "babel_sub_spot_BIX_BTC_depth"
}

订阅成功返回数据的例子

[{
    "channel": "babel_sub_spot_BIX_BTC_depth",
"data_type": 0, "data": { "pair":"BIX_BTC", "update_time":1536648343927, "asks":[ { "price":"0.0000683", "volume":"1048.8046" }, { "price":"0.00006831", "volume":"1008.2509" }, ... // other data ], "bids":[ { "price":"0.00006801", "volume":"2.3472" }, { "price":"0.00006793", "volume":"0.3458" }, ... // other data ] } }]

data说明

"bids": 买方深度列表
"asks": 卖方深度列表
{
    "price": 委托价格,
    "volume": 委托数量
}

之后每当 Depth 有更新时,client 都会收到全量数据,例子

[{
    "channel": "babel_sub_spot_BIX_BTC_depth",
"data_type": 1, "data": { "pair":"BIX_BTC", "update_time":1536648343927, "asks":[ { "price":"0.0000683", "volume":"1048.8046" }, { "price":"0.00006831", "volume":"1008.2509" }, ... // other data ], "bids":[ { "price":"0.00006801", "volume":"2.3472" }, { "price":"0.00006793", "volume":"0.3458" }, ... // other data ] } }]