【API 公告】关于API新增深度行情的增量数据推送(一期)的公告

火币 2019-12-19 03:26
分享至
微信扫一扫,打开网页后点击屏幕右上角分享按钮

尊敬的用户,

自本通知生效之日起,火币Global将新增Websocket订阅频道market.$symbol.mbp.$levels用于MBP(Market By Price)深度行情的逐笔推送。该频道同时支持用户以req方式请求获取全量数据。

请求频道market.$symbol.mbp.$levels

请求参数

字段名称 是否必需 描述
symbol 交易代码(不支持通配符)
levels MBP档位数(5,10,20,150)

返回数据

字段名称 数据类型 描述
seqNum integer 消息序列号
bids string [] 买盘(按price降序排列)
["price","size"]
asks string [] 卖盘(按askPrice升序排列)
["price","size"]

订阅频道market.$symbol.mbp.$levels

请求参数

字段名称 是否必需 描述
symbol 交易代码(不支持通配符)
levels MBP档位数(5,10,20,150)

返回数据

字段名称 数据类型 描述
seqNum integer 消息序列号
prevSeqNum integer 上一消息序列号
bids string [] 买盘(按price降序排列)
["price","size"]
asks string [] 卖盘(按askPrice升序排列)
["price","size"]

示例1 – req获取全量数据

{'id': 'id21', 'rep': 'market.btcusdt.mbp.150', 'status': 'ok', 'data': {'seqNum': 100020142010, 'bids': [[618.37, 71.594], [423.33, 77.726], [223.18, 47.997], [219.34, 24.82], [210.34, 94.463], [204.53, 22.008], [198.05, 82.049], [167.13, 97.114], [117.17, 19.352], [99.11, 38.48245239754659], [84.66, 5.925], [83.83, 57.00126344490675], [80.35, 18.433], [72.7, 71.34128402595132], [72.29, 18.846], [72.07, 95.668], [69.8, 64.874], [69.65, 2.347], [69.19, 51.479], [67.62, 40.526], [63.34, 0.8771003950771937], [63.2, 63.852], [62.15, 82.58], [62.12, 97.377], [61.8, 45.9539205169449], [61.78, 11.231], [61.74, 69.249], [61.72, 36.58], [61.69, 52.627], [61.68, 50.974], [61.55, 50.965], [61.52, 88.064], [61.48, 22.228], [61.42, 28.467], [61.34, 30.285], [61.32, 19.389], [61.28, 15.00109220651907], [61.26, 207.516], [61.24, 35.307], [61.23, 30.977], [61.22, 162.604], [61.21, 99.545], [61.2, 97.177], [61.19, 26.572], [61.17, 59.195], [61.16, 96.64], [61.15, 85.264], [61.14, 90.242], [61.13, 30.394], [61.12, 65.782], [61.11, 174.185], [61.1, 43.89], [61.09, 36.893], [61.08, 37.825], [61.06, 160.019], [61.04, 167.899], [61.03, 70.506], [61.02, 18.654], [61.01, 59.536], [60.99, 180.02], [60.98, 89.532], [60.97, 169.404], [60.95, 126.995], [60.94, 12.498], [60.92, 88.781], [60.91, 14.727], [60.9, 67.195], [60.89, 67.127], [60.87, 235.546], [60.85, 68.383], [60.84, 71.25], [60.83, 7.756], [60.79, 35.908], [60.78, 22.914], [60.77, 70.389], [60.76, 49.77], [60.75, 163.658], [60.74, 13.597], [60.73, 124.56], [60.71, 103.467], [60.7, 21.721], [60.68, 38.754], [60.67, 64.175], [60.66, 38.445], [60.65, 40.985], [60.64, 121.238], [60.63, 9.673], [60.62, 207.061], [60.6, 39.138], [60.59, 72.011], [60.57, 121.376], [60.56, 84.822], [60.55, 137.459], [60.54, 53.793], [60.53, 157.01], [60.52, 66.257], [60.51, 89.356], [60.5, 1.635], [60.49, 125.283], [60.48, 199.118], [60.47, 69.516], [60.46, 152.252], [60.45, 67.069], [60.44, 63.928], [60.43, 9.647], [60.42, 49.781], [60.41, 46.134], [60.4, 91.861], [60.39, 52.487], [60.38, 111.636], [60.37, 122.307], [60.35, 184.275], [60.34, 78.059], [60.33, 54.427], [60.31, 27.704], [60.28, 30.414], [60.27, 58.388], [60.26, 56.321], [60.24, 52.976], [60.22, 0.828], [60.21, 99.166], [60.19, 34.45], [60.17, 92.639], [60.15, 93.4], [60.14, 73.585], [60.13, 165.401], [60.06, 68.354], [60.05, 75.296], [60.04, 152.974], [60.03, 83.667], [60.01, 160.114], [60.0, 157.741], [59.99, 131.641], [59.98, 9.974], [59.97, 37.564], [59.96, 98.764], [59.95, 64.301], [59.94, 56.357], [59.91, 109.974], [59.9, 80.386], [59.88, 208.818], [59.87, 108.063], [59.86, 10.053], [59.84, 34.24], [59.83, 145.421], [59.81, 108.084], [59.8, 4.936], [59.79, 88.264], [59.78, 97.956], [59.77, 32.079]], 'asks': [[650.59, 14.909733438479636], [650.63, 97.996], [650.77, 97.465], [651.23, 83.973], [651.42, 34.465], [651.61, 7.822], [652.12, 57.819], [654.26, 63.142], [655.5, 54.362], [655.93, 38.034], [656.25, 17.21], [656.33, 44.605], [657.72, 5.176], [657.91, 10.644849251676206], [658.1, 80.697], [658.44, 52.804], [658.49, 92.026], [658.63, 21.733], [658.66, 28.872], [658.69, 77.436], [658.88, 28.086], [659.26, 82.323], [660.85, 79.252], [660.96, 52.131], [661.03, 24.8], [661.05, 96.311], [661.08, 8.028], [661.2, 65.354], [661.54, 39.616], [661.62, 17.165], [661.95, 18.299], [662.1, 0.22], [662.35, 6.172], [662.44, 52.443], [662.86, 7.579], [663.37, 59.775], [663.65, 44.612], [663.89, 46.324], [663.99, 85.936], [664.39, 28.659], [664.67, 52.079], [664.83, 41.999], [665.25, 74.079], [665.87, 58.769], [666.44, 7.028], [666.49, 43.58], [666.51, 68.819], [666.68, 93.158], [666.86, 49.504], [666.96, 32.644], [668.45, 63.03], [668.73, 21.391], [668.74, 48.152], [668.9, 56.945], [668.91, 46.599], [668.94, 2.436], [669.12, 22.838826503966004], [669.18, 6.378], [669.37, 99.502], [669.39, 57.98], [669.44, 78.716], [669.48, 91.519], [669.55, 55.022], [669.62, 14.649], [669.68, 6.161], [669.75, 28.483], [669.77, 55.106], [669.85, 6.636], [669.88, 64.139], [669.89, 53.648], [669.97, 97.053], [670.12, 83.221], [670.15, 13.681], [670.19, 37.937], [670.2, 48.251], [670.36, 45.997], [670.48, 3.183], [670.52, 41.815], [670.55, 95.075], [670.67, 63.573], [670.72, 4.565], [670.78, 33.859], [670.79, 51.768], [670.85, 51.966], [670.88, 91.448], [670.92, 63.408], [670.96, 83.33], [670.97, 4.667118475698068], [670.99, 81.623], [671.0, 37.573], [671.01, 1.424], [671.07, 24.685], [671.08, 86.418], [671.1, 33.885], [671.12, 36.824], [671.13, 94.727], [671.17, 64.128], [671.21, 152.034], [671.23, 16.243], [671.25, 26.242], [671.26, 113.513], [671.36, 81.574], [671.41, 159.786], [671.43, 17.54], [671.45, 22.587], [671.46, 156.968], [671.47, 60.138], [671.48, 69.138], [671.59, 54.687], [671.65, 148.23], [671.68, 20.94], [671.69, 65.143], [671.77, 22.55], [671.81, 174.855], [671.83, 80.369], [671.87, 65.099], [671.89, 18.528], [671.94, 31.721], [671.97, 26.026], [671.98, 22.742], [672.02, 34.675], [672.06, 27.126], [672.07, 85.067], [672.11, 98.982], [672.13, 29.915], [672.14, 7.987], [672.17, 128.325], [672.31, 19.35], [672.34, 75.68], [672.39, 27.623], [672.41, 4.339], [672.46, 169.221], [672.53, 6.807], [672.55, 33.975], [672.62, 8.037], [672.68, 20.603], [672.69, 92.931], [672.72, 12.204], [672.77, 55.775], [672.85, 27.12], [672.87, 33.727], [672.89, 16.66432115270567], [672.9, 75.852], [672.92, 98.468], [672.94, 45.896], [672.96, 21.276], [672.98, 90.336], [672.99, 107.692], [673.0, 71.496], [673.01, 103.526]]}}

示例2 – sub增量推送数据

{"ch":"market.btcusdt.mbp.150","ts":1573199608679,"tick":{"seqNum":100020146795,"prevSeqNum":100020146794,"bids":[],"asks":[[645.140000000000000000,26.755973959140651643]]}}

建议下游数据处理方式

订阅增量数据并开始缓存; 请求全量数据(同等档位数)并根据该全量消息的seqNum与缓存增量数据中的prevSeqNum对齐; 开始连续增量数据接收与计算,构建并持续更新MBP订单簿; 每条增量数据的prevSeqNum须与前一条增量数据的seqNum一致,否则意味着存在增量数据丢失,须重新获取全量数据并对齐; 如果收到增量数据包含新增price档位,须将该price档位插入MBP订单簿中适当位置; 如果收到增量数据包含已有price档位,但size不同,须更新MBP订单簿中该price档位的size; 如果收到增量数据某price档位的size为0值,须将该price档位从MBP订单簿中删除; 如果收到单条增量数据中包含两个及以上price档位的更新,这些price档位须在MBP订单簿中被同时更新。

一期上线内容及局限性

仅支持150档(levels=150),暂不支持5、10、20档MBP行情; 仅支持100ms快照MBP行情的增量推送,暂不支持更低快照间隔甚至逐笔MBP行情的增量推送; 仅支持19只交易对(btcusdt,ethusdt,eosusdt,bchusdt,ltcusdt,xrpusdt,htusdt,bsvusdt,etcusdt,zecusdt,ethbtc,eosbtc,bchbtc,ltcbtc,xrpbtc,htbtc,bsvbtc,etcbtc,zecbtc)的增量MBP行情,暂不支持其它交易对。

生效日期:2019年12月23日(GMT+8)

具体变更细节及参数要求,请参考API文档:https://huobiapi.github.io/docs/spot/v1/cn/

火币全球站
2019年12月18日

btcfans公众号

微信扫描关注公众号,及时掌握新动向

来源链接: 火币
标签: 重要公告
上一篇:【API 公告】关于API新增冻结&解冻子账号接口的公告 下一篇:OKEx Jumpstart质押挖矿项目Woo Network简介