Skip to content

REST 深度盘口

CoinTiger-API edited this page Jan 7, 2019 · 7 revisions

NOTE

替换$symbol$为tchbtc, ethbtc等相应币对


请求参数:

参数名称 是否必须 类型 描述 默认值 取值范围
symbol true String 交易对 tchbtc, ethbtc,btcbitcny,eosbtc...
type true String Depth 类型 深度有3个维度(代表价格精度小数位),"step0", "step1", "step2"

响应数据:

参数名称 是否必须 类型 描述 取值范围
code true String 请求处理状态 0成功
非0具体错误原因
msg true String 具体错误描述or成功描述
ch true String 数据所属的 channel,
格式:market.$ symbol$.depth.$type$

tick 说明:

 "tick": {
    "ts": 消息生成时间,单位:毫秒,
    "buys": 买盘,[price(成交价), amount(成交量)], 按price降序,
    "asks": 卖盘,[price(成交价), amount(成交量)], 按price升序
  }

请求响应示例:

/* GET /api/market/depth?symbol=btcbitcny&type=step0 */
{
    "code": "0",
    "msg": "suc",
    "data": {
        "ch": "market.btcbitcny_depth.step0",
        "depth_data": {
            "tick": {
                "buys": [
                   ["49896.81", 0.0441],// [price, amount]
				  ["49936.23", 0.0021]
				  ...
				  // more data here
                ],
                "asks": [
                    ["49896.81", 0.0441],
				   ["49936.23", 0.0021]
				   ...
				   // more data here
                ]
            },
            "ts": 1521860775784
        }
    }
}

/* GET /api/market/depth?symbol=btcbitcny&type=step0 */
{
    "code": "2",
    "msg": "您已超出API调用次数限制",
    "data": null
}

/* GET /api/market/depth?symbol=not-exist&type=step0 */
{
    "code": "2",
    "msg": "symbol 不能为空",
    "data": null
}

/* GET /api/market/depth?symbol=btcbitcny&type=not-exist */
{
    "code": "2",
    "msg": "type 请求参数不合法", // 参数范围[step0,step1,step2]
    "data": null
}