BTC /appApi.html?action=depth&symbol=1
# Request POST BTC /appApi.html?action=depth&symbol=1 # Response { "code": 200, "msg": "获取深度数据", "time": 1486203073756, "data": { "date": 1478758913, "asks": [ [ 5003.68, 0.275 ] ], "bids": [ [ 4903.66, 0.075 ] ] } }
date : 返回数据时服务器时间 asks : 卖方深度 bids : 买方深度
BTC /appApi.html?action=kline&symbol=1&step=60
# Request POST /appApi.html?action=kline&symbol=1&step=60 # Response { "code": 200, "msg": "获取K线数据", "time": 1486203073756, "data": "[[1478746261695,4939.32,4939.97,4938.74,4939.58,446.9005]]" }
[ 1478746261695, 时间戳 4939.32, 开 4939.97, 高 4938.74, 低 4939.58, 收 446.9005 交易量 ]
BTC /appApi.html?action=market&symbol=1
# Request POST /appApi.html?action=market&symbol=1 # Response { "code": 200, "msg": "获取实时行情", "time": 1486203073756, "data": { "high": 4962.03, "vol": 1633159.5247, "last": 4899.26, "low": 4876, "buy": 4898.93, "sell": 4899.26 } }
high: 最高价 vol: 成交量(24小时) last: 最新成交价 low: 最低价 buy: 买一价 sell: 卖一价
BTC /appApi.html?action=trades?&symbol=1
# Request POST /appApi.html?action=trades&symbol=1 # Response { "code": 200, "msg": "获取最新成交记录", "time": 1486203073756, "data": [ { "amount": 1.7931, "price": 4906.49, "id": 1, "time": "15:59:24", "en_type": "ask", "type": "卖出" } }
amount: 交易数量 price: 交易价格 id: 数据ID time: 交易时间 en_type: 交易类型 ask/bid type: 交易类型 卖出/买入
/appApi.html?action=mappings
# Request POST /appApi.html?action=mappings # Response { "code": 200, "msg": "获取所有的交易对", "time": 1533202458000, "data": [ { "symbol": 2, "count1": 8, "count2": 6, "mapping": "LTC_BTC" }, { "symbol": 3, "count1": 8, "count2": 6, "mapping": "LTC_USDT" }, { "symbol": 4, "count1": 8, "count2": 6, "mapping": "ETH_USDT" }, { "symbol": 5, "count1": 8, "count2": 6, "mapping": "ETH_BTC" }, { "symbol": 6, "count1": 8, "count2": 6, "mapping": "BCH_USDT" }, { "symbol": 7, "count1": 8, "count2": 6, "mapping": "BTC_USDT" }, { "symbol": 8, "count1": 8, "count2": 6, "mapping": "BCH_BTC" } ] }
symbol: 交易对ID count1: 单价小数位 count2: 数量小数位 mapping: 交易对名称
> 1. 获取API认证的apiKey和secretKey 申请API即可获得apiKey和secretKey,其中apiKey是提供给API用户的访问密钥,secretKey用于对请求参数签名的私钥。 注意: 请勿向任何人泄露这两个参数,这两个参数关乎账号安全。 > 2. 生成待签名字符串 用户提交的参数除sign外,都要参与签名。 待签名字符串要求按照参数名进行排序(首先比较所有参数名的第一个字母,按abcd顺序排列,若遇到相同首字母,则看第二个字母, 以此类推。) 例如:对于如下的参数进行签名 string[] parameters={"api_key=c821db84-6fbd-11e4-a9e3-c86000d26d7c","symbol=btc_cny","type=0","price=680","amount=1.0"}; 生成待签名字符串为:amount=1.0&api_key=c821db84-6fbd-11e4-a9e3-c86000d26d7c&price=680&symbol=btc_cny&type=0 > 3. MD5签名 在MD5签名时,需要私钥secretKey参与签名。 将待签名字符串添加私钥参数生成最终待签名字符串, 例如:amount=1.0&api_key=c821db84-6fbd-11e4-a9e3-c86000d26d7c&price=680&symbol=btc_cny&type=0&secret_key=secretKey 注意“&secret_key=secretKey” 为签名必传参数。 利用32位MD5算法 对最终待签名字符串进行签名运算,从而得到签名结果字符串(该字符串赋值于参数 sign),MD5计算结果中字母全部大写。
BTC /appApi.html?action=trade&symbol=1&type=0&amount=1&price=5000
# Request POST /appApi.html?action=trade&symbol=1&type=0&amount=1&price=5000 # Response { "code": 200, "msg": "委托成功", "time": 1486203073756, "data": null }
code : 返回码 msg : 返回消息 time : 时间戳(ms) data : 携带数据
BTC /appApi.html?action=cancel_entrust?id=1
# Request POST /appApi.html?action=cancel_entrust?id=1 # Response { "code": 200, "msg": "撤单成功", "time": 1486203073756, "data": null }
code : 返回码 msg : 返回消息 time : 时间戳(ms) data : 携带数据
BTC /appApi.html?action=trade&symbol=1&type=0&amount=1&price=5000
# Request POST /appApi.html?action=trade&symbol=1&type=0&amount=1&price=5000 # Response { "code": 200, "msg": "委托成功", "time": 1486203073756, "data": null }
code : 返回码 msg : 返回消息 time : 时间戳(ms) data : 携带数据
BTC /appApi.html?action=entrust&symbol=1
# Request POST /appApi.html?action=entrust&symbol=1 # Response { "code": 200, "msg": "查询当前委单", "time": 1486203073756, "data": null }
code : 返回码 msg : 返回消息 time : 时间戳(ms) data : 携带数据
BTC /appApi.html?action=lastentrust&symbol=1
# Request POST /appApi.html?action=lastentrust&symbol=1 # Response { "code": 200, "msg": "查询最新10笔成交委单", "time": 1486203073756, "data": null }
code : 返回码 msg : 返回消息 time : 时间戳(ms) data : 携带数据
BTC /appApi.html?action=order&id=1
# Request POST /appApi.html?action=order&id=1 # Response { "code": 200, "msg": "根本id查委托订单详细信息", "time": 1486203073756, "data": null }
code : 返回码 msg : 返回消息 time : 时间戳(ms) data : 携带数据
BTC /appApi.html?action=userinfo
# Request POST /appApi.html?action=userinfo # Response { "code": 200, "msg": "成功", "time": 1486203073756, "data": { "frozen": { "BTC": 0, "ETC": 0, "LTC": 0, "CNY": 0 }, "free": { "BTC": 0, "ETC": 0, "LTC": 0, "CNY": 0 } } }
code : 返回码 msg : 返回消息 data : 携带数据 free : 可用资产 frozen : 冻结资产 asset : 总资产