Binance Websocket深度通道对给定ID的更新过多

时间:2018-09-04 13:47:53

标签: api websocket binance

我正在使用Binance Websocket API,当我订阅深度频道时(例如通过wss://stream.binance.com:9443 / stream?streams = btcusdt @ depth /),我偶尔会收到更新对于给定的第一个ID('U')和最后一个ID('u')具有太多更新:

{"stream":"btcusdt@depth","data":{"e":"depthUpdate","E":1536066285499,"s":"BTCUSDT",
"U":238495725,
"u":238495734,
"b":[
["7369.47000000","0.00000000",[]], --238495725
["7369.46000000","0.00000000",[]], --238495726
["7369.45000000","0.00000000",[]], --238495727
["7369.19000000","0.90770800",[]], --238495728
["7365.20000000","0.20000000",[]], --238495729
["7363.71000000","0.54130000",[]], --238495730
["7362.94000000","0.00000000",[]], --238495731
["7358.00000000","0.00000000",[]]] --238495732
,"a":[
["7369.47000000","0.02302600",[]], --238495733
["7369.70000000","0.00000000",[]], --238495734
["7408.90000000","3.93000000",[]]] --238495735 WHICH IS NOT OKAY (>u)
}}

我还注意到,偶尔我会得到比更新更多的ID,例如:

{"stream":"btcusdt@depth","data":{"e":"depthUpdate","E":1536068517031,"s":"BTCUSDT",
"U":238514909,
"u":238514912,
"b":[],
"a":[
["7366.54000000","0.00000000",[]], --238514909
["7367.09000000","0.00000000",[]]] --238514910
}}

我正尝试将这些更新添加到数据库中,因此,对于ID而言,过多的问题比对ID少的问题少。如果有人能解释为什么会这样,或者我怎么会误解更新ID,将不胜感激。

谢谢!

1 个答案:

答案 0 :(得分:0)

因此,事实证明“更新ID”与订单ID不对应,并且可以在一次更新中更改多个订单簿条目。

此外,给定的出价和要价的顺序不是收到的实际顺序,而是出价的降序和要价的升序,无法从网络套接字确定性地获得订单簿的状态API:/