接口列表 |
|
|
|
|
接口数据类型 | 请求方法 | 类型 | 描述 | 需要验签 |
市场行情 | GET /market/history/kline | GET | K线 | N |
市场行情 | GET /market/detail/merged | GET | 滚动24小时交易和最优报价聚合行情(单个symbol) | N |
市场行情 | GET /market/tickers | GET | 全部symbol的交易行情 | N |
市场行情 | GET /market/depth | GET | 市场深度行情(单个symbol) | N |
市场行情 | GET /market/trade | GET | 单个symbol最新成交记录 | N |
市场行情 | GET /market/history/trade | GET | 单个symbol批量成交记录 | N |
市场行情 | GET /market/detail | GET | 滚动24小时交易聚合行情(单个symbol) | N |
交易品种信息 | GET /v1/common/symbols | GET | 交易品种的计价货币和报价精度 | N |
交易品种信息 | GET /v1/common/currencys | GET | 交易币种列表 | N |
系统信息 | GET /v1/common/timestamp | GET | 查询当前系统时间 | N |
账户信息 | GET /v1/account/accounts | GET | 查询用户的所有账户状态 | Y |
账户信息 | GET /v1/account/accounts/{account-id}/balance | GET | 查询指定账户余额 | Y |
交易 | POST/v1/order/orders/place | POST | 下单 | Y |
交易 | POST/v1/order/orders/{order-id}/submitcancel | POST | 按order-id撤销一个订单 | Y |
交易 | POST /v1/order/orders/batchcancel | POST | 按order_id, 批量撤销订单(up to 50) | Y |
交易 | POST /v1/order/orders/batchCancelOpenOrders | POST | 按订单条件批量撤销订单(up to 100) | Y |
用户订单信息 | GET /v1/order/orders/{order-id} | GET | 根据order-id查询订单详情 | Y |
用户订单信息 | GET /v1/order/orders/{order-id}/matchresults | GET | 根据order-id查询订单的成交明细 | Y |
用户订单信息 | GET /v1/order/orders | GET | 查询用户当前委托、或历史委托订单 (up to 100) | Y |
用户订单信息 | GET /v1/order/matchresults | GET | 查询用户当前成交、历史成交 | Y |
用户订单信息 | GET /v1/order/openOrders | GET | 查询用户当前未成交订单 (up to 500) | Y |
充提币 | POST /v1/dw/withdraw/api/create | POST | 申请提币 | Y |
充提币 | POST /v1/dw/withdraw-virtual/{withdraw-id}/cancel | POST | 撤销提币申请 | Y |
充提币 | GET /v1/query/deposit-withdraw | GET | 查询充提记录 | Y |
杠杆交易 | POST /v1/dw/transfer-in/margin | POST | 从币币交易账户划转至杠杆账户 | Y |
杠杆交易 | POST /v1/dw/transfer-out/margin | POST | 从杠杆账户划转至币币交易账户 | Y |
杠杆交易 | POST /v1/margin/orders | POST | 申请借贷 | Y |
杠杆交易 | POST /v1/margin/orders/{order-id}/repay | POST | 归还借贷 | Y |
杠杆交易 | GET /v1/margin/loan-orders | GET | 查询借贷记录 | Y |
杠杆交易 | GET /v1/margin/accounts/balance | GET | 查询杠杆账户余额 | Y |
ETF换入换出 | GET /etf/swap/config | GET | ETF换入换出的基本信息,ETF换入换出状态,以及ETF的成分结构。 | Y |
ETF换入换出 | POST/etf/swap/in | POST | 用户可以通过该接口换入一定数量的ETF. | Y |
ETF换入换出 | POST/etf/swap/out | POST | 用户可以通过该接口换出一定数量的ETF. | Y |
ETF换入换出 | GET/etf/list | GET | ETF换入换出操作的明细记录。最多返回 100 条记录。 | Y |
ETF换入换出 | GET/quotation/market/history/kline | GET | ETF净值的K线 | N |
母子账号 | POST /v1/subuser/transfer | POST | 母账号执行母子账户之间的划转 | Y |
母子账号 | GET /v1/subuser/aggregate-balance | GET | 母账号查询所有子账号各币种资产累加余额 | Y |
母子账号 | GET /v1/account/accounts/{sub-uid} | GET | 母账号查询某个子账号的各币种和各账户类型的余额 | Y |
市场行情 |
|
|
|
|
在调用行情接口时,请添加get参数,key为AccessKeyId ,value为网页上申请的apikey的accesskey 。 |
例: |
|
|
|
|
https://api.huobipro.com/market/history/kline?period=1day&size=200&symbol=btcusdt&AccessKeyId=fff-xxx-ssss-kkk |
|
|
|
|
|
GET /market/history/kline 获取K线数据 |
|
请求参数: |
|
|
|
|
参数名称 | 是否必须 | 类型 | 描述 | 默认值 |
symbol | TRUE | string | 交易对 |
|
period | TRUE | string | K线类型 |
|
size | FALSE | integer | 获取数量 | 150 |
响应数据: |
|
|
|
|
参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 |
status | TRUE | string | 请求处理结果 | "ok" , "error" |
ts | TRUE | number | 响应生成时间点,单位:毫秒 |
|
tick | TRUE | object | KLine 数据 |
|
ch | TRUE | string | 数据所属的 channel,格式: market.$symbol.kline.$period |
|
data 说明: |
|
|
|
|
"data": [ |
|
|
|
|
{ |
|
|
|
|
"id": K线id, |
|
|
|
|
"amount": 成交量, |
|
|
|
"count": 成交笔数, |
|
|
|
"open": 开盘价, |
|
|
|
"close": 收盘价,当K线为最晚的一根时,是最新成交价 |
"low": 最低价, |
|
|
|
"high": 最高价, |
|
|
|
"vol": 成交额, 即 sum(每一笔成交价 * 该笔的成交量) |
} |
|
|
|
|
] |
|
|
|
|
请求响应示例: |
|
|
|
|
/* GET /market/history/kline?period=1day&size=200&symbol=btcusdt */ |
{ |
|
|
|
|
"status": "ok", |
|
|
|
"ch": "market.btcusdt.kline.1day", |
|
|
"ts": 1499223904680, |
|
|
|
"data": [ |
|
|
|
|
{ |
|
|
|
|
"id": 1499184000, |
|
|
|
"amount": 37593.0266, |
|
|
|
"count": 0, |
|
|
|
|
"open": 1935.2000, |
|
|
|
"close": 1879.0000, |
|
|
|
"low": 1856.0000, |
|
|
|
"high": 1940.0000, |
|
|
|
"vol": 71031537.97866500 |
|
|
}, |
|
|
|
|
// more data here |
|
|
|
] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* GET /market/history/kline?period=not-exist&size=200&symbol=ethusdt */ |
{ |
|
|
|
|
"ts": 1490758171271, |
|
|
|
"status": "error", |
|
|
|
"err-code": "invalid-parameter", |
|
|
"err-msg": "invalid period" |
|
|
} |
|
|
|
|
|
|
|
|
|
/* GET /market/history/kline?period=1day&size=not-exist&symbol=ethusdt */ |
{ |
|
|
|
|
"ts": 1490758221221, |
|
|
|
"status": "error", |
|
|
|
"err-code": "bad-request", |
|
|
"err-msg": "invalid size, valid range: [1,2000]" |
} |
|
|
|
|
|
|
|
|
|
/* GET /market/history/kline?period=1day&size=200&symbol=not-exist */ |
{ |
|
|
|
|
"ts": 1490758171271, |
|
|
|
"status": "error", |
|
|
|
"err-code": "invalid-parameter", |
|
|
"err-msg": "invalid symbol" |
|
|
} |
|
|
|
|
GET /market/detail/merged 获取聚合行情(Ticker) |
请求参数: |
|
|
|
|
参数名称 | 是否必须 | 类型 | 描述 | 默认值 |
symbol | TRUE | string | 交易对 |
|
响应数据: |
|
|
|
|
参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 |
status | TRUE | string | 请求处理结果 | "ok" , "error" |
ts | TRUE | number | 响应生成时间点,单位:毫秒 |
|
tick | TRUE | object | K线数据 |
|
ch | TRUE | string | 数据所属的 channel,格式: market.$symbol.detail.merged |
|
tick 说明: |
|
|
|
|
"tick": { |
|
|
|
|
"id": K线id, |
|
|
|
|
"amount": 成交量, |
|
|
|
"count": 成交笔数, |
|
|
|
"open": 开盘价, |
|
|
|
"close": 收盘价,当K线为最晚的一根时,是最新成交价 |
"low": 最低价, |
|
|
|
"high": 最高价, |
|
|
|
"vol": 成交额, 即 sum(每一笔成交价 * 该笔的成交量) |
"bid": [买1价,买1量], |
|
|
|
"ask": [卖1价,卖1量] |
|
|
|
} |
|
|
|
|
|
|
|
|
|
请求响应示例: |
|
|
|
|
/* GET /market/detail/merged?symbol=ethusdt */ |
|
{ |
|
|
|
|
"status":"ok", |
|
|
|
|
"ch":"market.ethusdt.detail.merged", |
|
|
"ts":1499225276950, |
|
|
|
"tick":{ |
|
|
|
|
"id":1499225271, |
|
|
|
"ts":1499225271000, |
|
|
|
"close":1885.0000, |
|
|
|
"open":1960.0000, |
|
|
|
"high":1985.0000, |
|
|
|
"low":1856.0000, |
|
|
|
"amount":81486.2926, |
|
|
|
"count":42122, |
|
|
|
|
"vol":157052744.85708200, |
|
|
"ask":[1885.0000,21.8804], |
|
|
"bid":[1884.0000,1.6702] |
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* GET /market/detail/merged?symbol=not-exist */ |
{ |
|
|
|
|
"ts": 1490758171271, |
|
|
|
"status": "error", |
|
|
|
"err-code": "invalid-parameter", |
|
|
"err-msg": "invalid symbol” |
|
|
} |
|
|
|
|
|
|
|
|
|
GET /market/tickers |
|
|
|
{ |
|
|
|
|
"status":"ok", |
|
|
|
"ts":1510885463001, |
|
|
|
"data":[ |
|
|
|
|
{ |
|
|
|
|
"open":0.044297, // 日K线 开盘价 |
"close":0.042178, // 日K线 收盘价 |
"low":0.040110, // 日K线 最低价 |
"high":0.045255, // 日K线 最高价 |
"amount":12880.8510, // 24小时成交量 |
"count":12838, // 24小时成交笔数 |
"vol":563.0388715740, // 24小时成交额 |
"symbol":"ethbtc" // 交易对 |
|
}, |
|
|
|
|
{ |
|
|
|
|
"open":0.008545, |
|
|
"close":0.008656, |
|
|
"low":0.008088, |
|
|
"high":0.009388, |
|
|
"amount":88056.1860, |
|
|
"count":16077, |
|
|
|
"vol":771.7975953754, |
|
|
"symbol":"ltcbtc" |
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
注:当交易对尚未产生成交时,返回的数据里面 open close high low amount count vol 的值都为 null |
GET /market/depth 获取 Market Depth 数据 |
请求参数: |
|
|
|
|
参数名称 | 是否必须 | 类型 | 描述 | 默认值 |
symbol | TRUE | string | 交易对 |
|
type | TRUE | string | Depth 类型 |
|
|
|
|
|
|
用户选择“合并深度”时,一定报价精度内的市场挂单将予以合并显示。合并深度仅改变显示方式,不改变实际成交价格。 |
响应数据: |
|
|
|
|
参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 |
status | TRUE | string |
| "ok" 或者 "error" |
ts | TRUE | number | 响应生成时间点,单位:毫秒 |
|
tick | TRUE | object | Depth 数据 |
|
ch | TRUE | string | 数据所属的 channel,格式: market.$symbol.depth.$type |
|
tick 说明: |
|
|
|
|
"tick": { |
|
|
|
|
"id": 消息id, |
|
|
|
"ts": 消息生成时间,单位:毫秒, |
|
|
"bids": 买盘,[price(成交价), amount(成交量)], 按price降序, |
"asks": 卖盘,[price(成交价), amount(成交量)], 按price升序 |
} |
|
|
|
|
请求响应示例: |
|
|
|
|
/* GET /market/depth?symbol=ethusdt&type=step1 */ |
{ |
|
|
|
|
"status": "ok", |
|
|
|
"ch": "market.btcusdt.depth.step1", |
|
"ts": 1489472598812, |
|
|
|
"tick": { |
|
|
|
|
"id": 1489464585407, |
|
|
|
"ts": 1489464585407, |
|
|
|
"bids": [ |
|
|
|
|
[7964, 0.0678], // [price, amount] |
|
[7963, 0.9162], |
|
|
|
[7961, 0.1], |
|
|
|
[7960, 12.8898], |
|
|
|
[7958, 1.2], |
|
|
|
[7955, 2.1009], |
|
|
|
[7954, 0.4708], |
|
|
|
[7953, 0.0564], |
|
|
|
[7951, 2.8031], |
|
|
|
[7950, 13.7785], |
|
|
|
[7949, 0.125], |
|
|
|
[7948, 4], |
|
|
|
|
[7942, 0.4337], |
|
|
|
[7940, 6.1612], |
|
|
|
[7936, 0.02], |
|
|
|
[7935, 1.3575], |
|
|
|
[7933, 2.002], |
|
|
|
[7932, 1.3449], |
|
|
|
[7930, 10.2974], |
|
|
|
[7929, 3.2226] |
|
|
|
], |
|
|
|
|
"asks": [ |
|
|
|
|
[7979, 0.0736], |
|
|
|
[7980, 1.0292], |
|
|
|
[7981, 5.5652], |
|
|
|
[7986, 0.2416], |
|
|
|
[7990, 1.9970], |
|
|
|
[7995, 0.88], |
|
|
|
[7996, 0.0212], |
|
|
|
[8000, 9.2609], |
|
|
|
[8002, 0.02], |
|
|
|
[8008, 1], |
|
|
|
|
[8010, 0.8735], |
|
|
|
[8011, 2.36], |
|
|
|
[8012, 0.02], |
|
|
|
[8014, 0.1067], |
|
|
|
[8015, 12.9118], |
|
|
|
[8016, 2.5206], |
|
|
|
[8017, 0.0166], |
|
|
|
[8018, 1.3218], |
|
|
|
[8019, 0.01], |
|
|
|
[8020, 13.6584] |
|
|
|
] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* GET /market/depth?symbol=ethusdt&type=not-exist */ |
{ |
|
|
|
|
"ts": 1490759358099, |
|
|
|
"status": "error", |
|
|
|
"err-code": "invalid-parameter", |
|
|
"err-msg": "invalid type" |
|
|
} |
|
|
|
|
GET /market/trade 获取 Trade Detail 数据 |
|
请求参数: |
|
|
|
|
参数名称 | 是否必须 | 类型 | 描述 | 默认值 |
symbol | TRUE | string | 交易对 |
|
响应数据: |
|
|
|
|
参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 |
|