Rest API
EXX为用户提供了一个简单的而又强大的API,旨在帮助用户快速高效的将EXX交易功能整合到自己应用当中。
如果在使用过程中有任何问题,请联系我们技术讨论QQ群:630260653[点击加群] ,我们将为您做出最权威的解答。
获取EXX最新市场行情数据
接口 | 描述 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
+- https://api.exx.com/data/v1/markets
所有市场
示例//# Request GET https://api.exx.com/data/v1/markets //# Response { "eos_btc":{ "minAmount":"0.00010", "amountScale":2, "priceScale":6, "maxLevels":0, "isOpen":false }, "etc_hsr":{ "minAmount":"0.001", "amountScale":3, "priceScale":3, "maxLevels":0, "isOpen":true }, ... } 返回值说明minAmount : 最小交易金额 amountScale : 买方币小数点 priceScale : 卖方币小数点 maxLevels : 最大杠杆倍数,0表示不开放杠杆 isOpen : 是否开盘 |
|||||||||||
+- https://api.exx.com/data/v1/tickers
所有行情
示例//# Request GET https://api.exx.com/data/v1/tickers //# Response { "bts_btc":{ "vol":0.0, "last":0, "sell":0.0, "buy":0.0, "weekRiseRate":0.0, "riseRate":0.0, "high":0.0, "low":0, "monthRiseRate":0.0 }, ... } 返回值说明vol : 成交量(最近的24小时) last : 最新成交价 sell : 卖一价 buy : 买一价 weekRiseRate : 周涨跌幅 riseRate : 24小时涨跌幅 high : 最高价 low : 最低价 monthRiseRate : 30日涨跌幅 |
|||||||||||
+- https://api.exx.com/data/v1/ticker
市场行情
示例//# Request GET https://api.exx.com/data/v1/ticker?currency=eth_hsr //# Response { "ticker": { "vol": "1447.851", "last": "30.487000000", "sell": "30.499", "buy": "30.487", "weekRiseRate": -1.17, "riseRate": 9.45, "high": "30.812", "low": "27.855", "monthRiseRate": -0.99 }, "date": "1510383406453" } 返回值说明vol : 成交量(最近的24小时) last : 最新成交价 sell : 卖一价 buy : 买一价 weekRiseRate : 周涨跌幅 riseRate : 24小时涨跌幅 high : 最高价 low : 最低价 monthRiseRate : 30日涨跌幅 请求参数说明
|
|||||||||||
+- https://api.exx.com/data/v1/depth
市场深度
示例//# Request GET https://api.exx.com/data/v1/depth?currency=eth_hsr //# Response { "asks": [ [ "32.831", "0.083" ]... ], "bids": [ [ "30.434", "10.766" ]... ], "timestamp" : 时间戳 } 返回值说明asks : 卖方深度 bids : 买方深度 timestamp : 此次深度的产生时间戳 请求参数说明
|
|||||||||||
+- https://api.exx.com/data/v1/trades
历史成交
示例//# Request GET https://api.exx.com/data/v1/trades?currency=eth_hsr //# Response [ { "amount" : 0.933, "price" : 31.595, "tid" : 2583932, "type" : "sell", "date" : 2583932, "trade_type" : "ask", }... ] 返回值说明amount : 交易数量 price : 交易价格 tid : 交易生成ID type : 交易类型,buy(买)/sell(卖) date : 交易时间(时间戳) trade_type : 委托类型,ask(卖)/bid(买) 请求参数说明
|
|||||||||||
+- https://api.exx.com/data/v1/klines
获取K线
示例//# Request https://api.exx.com/data/v1/klines?market=eth_btc&type=1min&size=1&assist=cny //# Response { "datas": { "limit": 1, "time": 60, "symbol": "eth_btc", "contractUnit": "ETH", "assistCoin": "btc", "data": [ [ 1529997660000, //时间戳 0.07301, //开盘价 0.07301, //最高价 0.072621, //最低价 0.072621, //收盘价 12.41 //交易量 ] ], "riseRate": 0, "since": 0, "type": "1min", "moneyType": "BTC" }, "isSuc": true, "resMsg": { "message": "SUCCESS", "code": 1000 } } 返回值说明limit : 条数 time : 1min对应的秒数 symbol : 市场名 contractUnit : 卖币币种的英文简称 assistCoin : 辅助货币的英文简称 data : kline数据 riseRate :汇率 since :开始时间 type :kline类型 moneyType :买币币种的英文简称 请求参数说明
|
交易API
用于EXX快速进行交易
接口 | 描述 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+- https://trade.exx.com/api/order
委托下单
示例//# Request GET https://trade.exx.com/api/order?accesskey=accesskey&amount=1.5¤cy=eth_hsr&nonce=当前时间毫秒数&price=1024&type=buy &signature=请求加密签名串 //# Response { "code": 100, "message": "操作成功", "id": "13877" } 返回值说明code : 返回代码 message : 提示信息 id : 委托挂单号 请求参数说明(加密签名请根据参数名的首字母顺序顺序签名,signature不用加入待签名字符串)
|
|||||||||||||||||
+- https://trade.exx.com/api/cancel
取消委托
示例//# Request GET https://trade.exx.com/api/cancel?accesskey=your_access_key¤cy=eth_hsr&id=123456789&nonce=当前时间毫秒数 &signature=请求加密签名串 //# Response { "code": "100", "message": "操作成功。" } 返回值说明code : 返回代码 message : 提示信息 请求参数说明(加密签名请根据这个顺序签名,signature不用加入待签名字符串)
|
|||||||||||||||||
+- https://trade.exx.com/api/getOrder
获取委托买单或卖单
示例//# Request GET https://trade.exx.com/api/getOrder?accesskey=your_access_key¤cy=eth_hsr&id=123456789&nonce=当前时间毫秒数 &signature=请求加密签名串 //# Response { "fees": 0, "total_amount": 1, "trade_amount": 0, "price": 31, "currency": “eth_hsr", "id": "13877", "trade_money": 0, "type": "buy", "trade_date": 1509728383300, "status": 0 } 返回值说明fees : 交易手续费 total_amount : 挂单总数量 trade_amount : 已成交数量 price : 单份单价 currency : 交易市场 id : 委托挂单号 trade_money : 已成交总金额 type: : 挂单类型buy/sell') trade_date : 时间戳 status : 挂单状态(0、待成交 1、取消 2、交易完成 3、待成交未交易部分) 请求参数说明(加密签名请根据这个顺序签名,signature不用加入待签名字符串)
|
|||||||||||||||||
+- https://trade.exx.com/api/getOpenOrders
获取多个委托买单或卖单,每次请求返回10条记录
示例//# Request GET https://trade.exx.com/api/getOpenOrders?accesskey=your_access_key¤cy=eth_hsr &nonce=当前时间毫秒数&pageIndex=1&type=buy&signature=请求加密签名串 //# Response [ { "fees": 0, "total_amount": 1, "trade_amount": 0, "price": 30, "currency": “eth_hsr", "id": "13878", "trade_money": 0, "type": "buy", "trade_date": 1509728897772, "status": 0 }, { "fees": 0, "total_amount": 1, "trade_amount": 0, "price": 30, "currency": “eth_hsr", "id": "13877", "trade_money": 0, "type": "buy", "trade_date": 1509728383300, "status": 0 } ] 返回值说明fees : 交易手续费 total_amount : 挂单总数量 trade_amount : 已成交数量 price : 单份单价 currency : 交易市场 id : 委托挂单号 trade_money : 已成交总金额 type: : 挂单类型 buy/sell trade_date : 时间戳 status : 挂单状态(0、待成交 1、取消 2、交易完成 3、待成交未交易部分) 请求参数说明(加密签名请根据这个顺序签名,signature不用加入待签名字符串)
|
|||||||||||||||||
+- https://trade.exx.com/api/getBalance
获取用户信息
示例//# Request GET https://trade.exx.com/api/getBalance?accesskey=your_access_key&nonce=当前时间毫秒数&signature=请求加密签名串 //# Response { "credits": [ { "flatRatio": "0.1", "userRatio": "0.0985", "noticeRatio": "0.2", "levels": 10, "flatPrice": 11.01471399 } ], "funds": { "BTS": { "total": "10", "freeze": "0", "balance": "10", "propTag": "BTS", "credit_quota": "121.938066", "credit_borrowed": "0", "credit_interest": "0" }, "MONA": { "total": "0.966033", "freeze": "0.966033", "balance": "0", "propTag": "MONA", "credit_quota": "0", "credit_borrowed": "0", "credit_interest": "0" }, .... "ETH": { "total": "10", "freeze": "0", "balance": "10", "propTag": "ETH", "credit_quota": "121.938066", "credit_borrowed": "0", "credit_interest": "0" }, "LTC": { "total": "0", "freeze": "0", "balance": "0", "propTag": "LTC", "credit_quota": "121.938066", "credit_borrowed": "0", "credit_interest": "0" }, "QTUM": { "total": "0.003", "freeze": "0.003", "balance": "0", "propTag": "QTUM", "credit_quota": "0", "credit_borrowed": "9.65", "credit_interest": "0.026252" } } } 返回值说明credits 借贷信息: flatRatio : 平仓风险比例, 当用户风险系数低于此值时,系统执行平仓操作 userRatio : 平仓比例, 用户风险系数 noticeRatio : 提醒比例, levels : 杠杆倍数, flatPrice : 平仓价格 funds(资产信息) : ETH(ETH资产详情): { total : 货币总量, freeze : 冻结数量, balance : 可用资产, propTag : 货币标识, credit_quota : 借款额度, credit_borrowed : 已使用额度, credit_interest : 未支付利息 } ... QTUM(QTUM资产详情): { total : 货币总量, freeze : 冻结数量, balance : 可用资产, propTag : 货币标识, credit_quota : 借款额度, credit_borrowed : 已使用额度, credit_interest : 未支付利息 } |
|||||||||||||||||
+- https://trade.exx.com/api/getChargeAddress
获取充值地址
示例//# Request GET https://trade.exx.com/api/getChargeAddress?accesskey=your_access_key¤cy=qtum&nonce=当前时间毫秒数&signature=请求加密签名串 //# Response { "code":100, "message" : { "des" : "success", "isSuc" : true, "datas" : { "currency":"qtum", "key":"QSWnWqpHiM7Rz2S4Ybf76seYNURPL3Z5TN" } } } 返回值说明code : 返回代码 message : 提示信息: des : 提示信息: isSuc : 提示信息: data :{ key : 充值地址, currency : 货币标识 } |
+- https://trade.exx.com/api/getChargeRecord
获取充值记录
示例//# Request GET https://trade.exx.com/api/getChargeRecord?accesskey=your_access_key¤cy=qtum&nonce=当前时间毫秒数&pageIndex=页数&signature=请求加密签名串 //# Response { "code":100, "message":{ "des": "success", "isSuc": true, "datas": { "total":2, "pageSize":10, "list":[{ "amount":11.000000000, "status":"-", "hash":"2018013019033000098753290", "submit_time":"2018-01-30 19:03:31" "confirmTimes":1 }, { "amount":11.000000000, "status":"-", "hash":"2018013018533000050778882", "submit_time":"2018-01-30 18:53:31" "confirmTimes":1 }, "pageIndex":1 } } } 返回值说明code : 返回代码 message : 提示信息: des : 提示信息: isSuc:提示信息: data:{ total : 记录数, status : 充值状态, hash : 充值交易号 submit_time : 充值时间, confirmTimes: 确认数 } |
||||||||||||||||
+- https://trade.exx.com/api/getWithdrawAddress
获取认证提币地址
示例//# Request GET https://trade.exx.com/api/getWithdrawAddress?accesskey=your_access_key¤cy=qtum&nonce=当前时间毫秒数&signature=请求加密签名串 //# Response { "code":100, "message":{ "des": "success", "isSuc": true, "datas": [{ "memo":"备注信息", "key":"QSWnWqpHiM7Rz2S4Ybf76seYNURPL3Z5TN", "currency":"qtum" }] } } 返回值说明code : 返回代码 message : 提示信息: des : isSuc: data:[{ memo : 备注, key : 提币地址地址, currency : 货币标识 }] |
|||||||||||||||||
+- https://trade.exx.com/api/getWithdrawRecord
获取提币记录
示例//# Request GET https://trade.exx.com/api/getWithdrawRecord?accesskey=your_access_key¤cy=qtum&nonce=当前时间毫秒数&pageIndex=页数&signature=请求加密签名串 //# Response { "code":100, "message":{ "des": "success", "isSuc": true, "datas": { "pageSize":10, "list":[{ "amount":11.00000000, "id":2018013084703, "status":"success", "submitTime":1517310691000, "manageTime":1517310812000, "receive":11.00000000, "toAddress":"QjedNoj5cU6M5Vv5ipWoPtZEebWBXskYnu" },{ "amount":11.00000000, "id":2018013084684, "status":"success", "submitTime":1517309701000, "manageTime":1517309912000, "receive":11.00000000, "toAddress":"QjedNoj5cU6M5Vv5ipWoPtZEebWBXskYnu" }] ,"pageIndex":1 } } } 返回值说明code : 返回代码 message : 提示信息: des : 提示信息: isSuc : 提示信息: data :{ pageSize:每页记录数, list: amount : 提币数量, id : 提币记录ID, status : 状态, submitTime : 提交时间, manageTime : 处理时间, receive : 到账金额, toAddress : 提币地址 } |
|||||||||||||||||
+- https://trade.exx.com/api/withdraw
提币
示例//# Request GET https://trade.exx.com/api/withdraw?accesskey=your_access_key&amount=10¤cy=qtum&nonce=当前时间毫秒数&receiveAddr=提币地址&safePwd=提币密码&signature=请求加密签名串 //# Response { "code":100, "message":"success", "id":"2018013084703" } 返回值说明code : 返回代码 message : 提示信息 id : 提币单号 |
示例代码
签名方式:根据secretkey把请求的参数签名,请求参数按照ascii值排序加密
//...... try{ //...... String params = "accesskey=yourAccessKey&nonce="+System. currentTimeMillis(); String secretKey = "yourSecretKey"; String baseURL = "https://trade.exx.com/api/getBalance"; String signature = HmacSHA512(params, secretKey); String url = baseURL + "?" + params + "&signature=" + signature; String result = doRequest(url); //String params = "accesskey=yourAccessKey&nonce=1234567890123"; //String secretKey = "yourSecretKey"; //通过HmacSHA512加密的结果为: //c247be4b0b3f448254e70d422d199c874afa8fe873fd25d39cc1d14e4d60700bdbe0ea681a57bf772a8c16706e8a4d4bef3cd362fcc89f03a15e7e1b9e1930b1 //...... }catch(Exception ex){ ex.printStackTrace(); } //......
常见问题
访问限制
1.单个IP限制每分钟1000次访问,超过1000次将被锁定1小时,一小时后自动解锁。
2.每个市场限制每秒钟10次访问,一秒钟内10次以上的请求,将会视作无效
3.资产接口每秒最多支持访问3次。
4.充提地址、充提记录接口每秒最多可访问1次。
5.提币权限需要在生成API密钥操作中开启,默认不开启。
6.子账号不允许提币操作。