• XT交易所API


    HTTPAPI

    xt为用户提供了一个简单的而又强大的API,旨在帮助用户快速高效的将xt交易功能整合到自己应用当中。

    API地址域名地址

    域名地址:https://www.xt.com/

    使用说明

    使用这些API之前首先要获取两项参数,在网站登录后,进入API功能开启然后获取Api Id和Api Secret两项参数。通过这两个参数拥有交易下单、提币等高级权限,请用户注意保密。所有http接口都需要进行签名,签名规则在后面说明。

    1配置及基础功能API

    1.1获取市场列表

    path:https://www.xt.com/exchange/config/controller/website/MarketController/getByWebId
    请求方式:get
    请求报文

    返回成功报文

    
    {
      { "datas": [
        {
          "amountDecimal": 8,//数量精度
          "minAmount": "0.0001000000",//最小数量
          "buyerCurrencyId": "2",//买方币种
          "priceDecimal": 8,//价格精度
          "serverId": "entrust-server-001",//服务ID
          "marketId": "70",//市场ID
          "webId": "100", //站点ID
          "modifyTime": 0,
          "sellerCurrencyId": "19",//卖方币种
          "createTime": 1522400906009,
          "defaultFee": "0.00050000",//默认费率
          "name": "zt_btc",//市场名称
          "leverType": "1",//杠杆类型: 1现货 2杠杆
          "state": 1,//状态: 1 运行, 0 停止 -1 删除
          "openTime": 1,//开盘时间
        },
        ....
      ],
      "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
      }
    }

    1.2获取币种列表

    path:https://www.xt.com/exchange/config/controller/website/CurrencyController/getCurrencyList
    请求方式 :get
    请求报文

    返回成功报文

    {
      "datas": [
        {
          "totalNumber": "230000000.00000000",//总量
          "tradeSearchUrl": null,//交易查询地址
          "tokenCoinsId": 0,//如果大于0是另一种币的token,否则等于0
          "minCash": null,
          "tokenName": null,//
          "description": "比特币",//描述
          "arithmetic": null,   //共识算法
          "dailyDrawLimit": 10000,
          "remark": null,   //
          "isLegalCoin": 0, //是否是法币,比如美金 1是,0不是
          "outConfigTimes": 0,//
          "timesFreetrial": "0",//
          "hourFreetrial": "0",//
          "inConfigTimes": 6,//
          "alias": "b",//别名
          "logo": "market-btc.png",//图标
          "needBlockUrl": 0,//是否需要block地址,0不需要 1需要
          "currencyId": "2",//币种id
          "drawFlag": 1,
          "rechargeFlag": 1,
          "onceDrawLimit": 100,
          "founder": null,
          "drawFee": "0.00100000",
          "blockChainUrl": "https://blockchain.info/tx/", //blockChain查询地址(区块查询地址)
          "dayFreetrial": "0",
          "marketValue": null,//总市值
          "minFee": null,
          "teamAddress": null,
          "defaultDecimal": 2,//币种小数位(精度)-优先级低于 market中的配置
          "publishNumber": "14500000.00000000",//已发行
          "isMining": "0",//是否可挖矿
          "name": "btc",//名称
          "limitAmount": null,
          "websiteCurrencyId": "223f4d23232",
          "descriptionEnglish": "<p>The BTC is ...</p>",//英文描述
          "mark": null//符号
        },
        .....
      ],
      "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
      }
    }

    2交易API

    2.1新增委托:

    path:https://www.xt.com/exchange/entrust/controller/website/EntrustController/addEntrust
    请求方式:post
    请求报文:

    json
    {
      "amount": 0,                          //下单数量
      "rangeType": 0,                       //委托类型,目前仅支持现价委托  0:现价委托  1 区间委托
      "type": 0,                            //买卖类型:0 卖出 1 购买
      "marketId": "90",                     //市场ID
      "price": 0                            //价格
    }

    返回报文:

    json
    {
      "datas":{
        “entrustId”:"E6419466484531482624"  //委托ID
      },
      "resMsg":{
        "code":"1",                        //1代表成功,其他为错误码见说明
        "method":null,
        "message":"success !"
      }
    }

    2.2取消委托

    path:https://www.xt.com/exchange/entrust/controller/website/EntrustController/cancelEntrust
    请求方式:post
    请求报文:

    json
    {
      "entrustId": "E6419466484531482624",  //要取消的委托ID
      "marketId": "90"                     //市场ID
    }

    返回报文:

    json
    {
      "datas":null,
      "resMsg":{
        "code":"1",                        //1代表成功,其他为错误码见说明
        "method":null,
        "message":"success !"
      }
    }

    2.3查询正在进行的委托

    path: https://www.xt.com/exchange/entrust/controller/website/EntrustController/getUserEntrustRecordFromCacheWithPage
    请求方式:get
    请求报文:

    marketId: 90                    //市场ID

    返回报文:

    json
    {
      "datas": [{
        "amount": "1.1",            //数量
        "rangeType": "0",            //区间类型 0 现价委托 1 区间委托
        "rangeLowPrice": "null",            //区间委托的最低价
        "rangeHighPrice": "null",            //区间委托的最高价
        "totalMoney": "5.555",            //总金额
        "entrustId": "E6437955999037923328",            //委托ID
        "type": "0",            //0 卖出 1 购买  -1 取消
        "userId": "test6",            //用户id
        "completeAmount": "0",            //已经成交的数量
        "marketId": "80",            //市场id
        "dealTimes": "0",            //交易处理次数
        "createTime": "1534928321609",            //下单时间
        "price": "5.05",            //单价
        "completeTotalMoney": "0",            //已完成的总金额
        "entrustType": "false",            //委托类型 0(false)普通委托单 1(true)杠杆委托单
        "status": "0",            //状态 : -2资金解冻失败 -1用户资金不足 0起始 1取消 2交易成功 3交易一部分
      }],
      "resMsg": {
        "code": "1",            //1代表成功,其他为错误码见说明
        "method": null,
        "message": "success !"
      }
    }

    2.4分页查询历史委托委托(只查询已经成交和已经取消的委托记录)

    paht: https://www.xt.com/exchange/entrust/controller/website/EntrustController/getUserEntrustList
    请求方式:get
    请求报文:

    marketId:   90                      //市场ID
    pageIndex:  1               //页码
    pageSize:   10              //每页展示条数

    返回报文:

    json
    {
      "datas": [{
        "amount": "1.1",            //数量
        "rangeType": "0",            //区间类型 0 现价委托 1 区间委托
        "rangeLowPrice": "null",            //区间委托的最低价
        "rangeHighPrice": "null",            //区间委托的最高价
        "totalMoney": "5.555",            //总金额
        "entrustId": "E6437955999037923328",            //委托ID
        "type": "0",            //0 卖出 1 购买  -1 取消
        "userId": "test6",            //用户id
        "completeAmount": "0",            //已经成交的数量
        "marketId": "80",            //市场id
        "dealTimes": "0",            //交易处理次数
        "createTime": "1534928321609",            //下单时间
        "price": "5.05",            //单价
        "completeTotalMoney": "0",            //已完成的总金额
        "entrustType": "false",            //委托类型 0(false)普通委托单 1(true)杠杆委托单
        "status": "0",            //状态 : -2资金解冻失败 -1用户资金不足 0起始 1取消 2交易成功 3交易一部分
      }],,
      "totalPage": "2",            //委托记录总条数
      "currentPage": "1",            //当前页数
      "resMsg": {
        "code": "1",            //1代表成功,其他为错误码见说明
        "method": null,
        "message": "success !"
      }
    }

    2.5根据委托单id查询委托记录

    path: https://www.xt.com/exchange/entrust/controller/website/EntrustController/getEntrustById
    请求方式:get
    请求参数:

    marketId:   90                      //市场ID
    entrustId:  E6419443135315070976    // 要查询的委托ID
    

    返回报文:

    {
      "datas": [{
        "amount": "1.1",            //数量
        "rangeType": "0",            //区间类型 0 现价委托 1 区间委托
        "rangeLowPrice": "null",            //区间委托的最低价
        "rangeHighPrice": "null",            //区间委托的最高价
        "totalMoney": "5.555",            //总金额
        "entrustId": "E6437955999037923328",            //委托ID
        "type": "0",            //0 卖出 1 购买  -1 取消
        "userId": "test6",            //用户id
        "completeAmount": "0",            //已经成交的数量
        "marketId": "80",            //市场id
        "dealTimes": "0",            //交易处理次数
        "createTime": "1534928321609",            //下单时间
        "price": "5.05",            //单价
        "completeTotalMoney": "0",            //已完成的总金额
        "entrustType": "false",            //委托类型 0(false)普通委托单 1(true)杠杆委托单
        "status": "0",            //状态 : -2资金解冻失败 -1用户资金不足 0起始 1取消 2交易成功 3交易一部分
      }],,
      "resMsg": {
        "code": "1",            // 1代表成功,其他为错误码见说明
        "method": null,
        "message": "success !"
      }
    }

    3 财务资金API

    3.1 获取充币地址

    path:https://www.xt.com/exchange/fund/controller/website/FundController/getPayinAddress
    请求方式:get
    请求报文

    {
        “currencyTypeName”:"btc" // 货币类型名称(必传)
    }

    返回报文

    
    {
        "datas": {
            "address": "19cdJwd3j6ArHNhiYoWpN8cJq9ash7WDDC",// 充币地址
            "wallet": "merchants014"
        },
        "resMsg": {
            "code": "1",
            "method": null,
            "message": "success !"
        }
    }
    

    3.2 查询充币记录

    path:https://www.xt.com/exchange/fund/controller/website/FundController/getPayinCoinRecord
    请求方式:post
    请求报文

    {
        “currencyTypeName”:“qtum”, // 货币类型
        “sort”:1 // 不传按充币时间倒序排,传了按升序排序
        "pageNum":1
        "pageSize":20
    }

    返回报文

    {
        "datas": {
            "totalRow": 1,  // 总行数
            "totalPage": 1, // 总页数
            "pageSize": 20, // 每页数量
            "list": [
                {
                    "currencyTypeId": 1,// 货币类型id
                    "depositId": “f3342424”,// 充值主键
                    "amount": "10.0",// 充币数量
                    "confirmTimes": "4",// 确认次数
                    "createTime": "2018-03-10 10:22:09.0",// 充币时间
                    "depositAddress": "1BKd2sSPYzxC2XHurR6oQWc2wzSx2rZzck",// 充币地址
                    "txId": "6378183001917882368",// 交易id
                    "userId": "1",// 用户id
                    "status": 1,//' 0:未到账  1:已到账  '
    
                }
            ],
            "pageNum": 1
        },
        "resMsg": {
            "code": "1",
            "method": null,
            "message": "success !"
        }
    }
    

    3.3 查询提币记录

    path:https://www.xt.com/exchange/fund/controller/website/FundWebSiteController/getPayoutCoinRecord
    请求方式:get
    请求报文

    currencyId=1    // 币种id(必选)
    tab=all         // (必选) | all(所有), wait(已提交,未审核), success(审核通过), fail(审核失败), cancel(用户主动取消)
    pageIndex=1     // 可选, 默认 1
    pageSize=10     // 可选, 默认 10

    返回报文

    {
        "datas": {
            "totalRow": 34,                                          // 总行数
            "totalPage": 4,                                          // 总页数
            "pageSize": 10,                                          // 每页数量
            "list": [
                {
                    "modifyUid": null,                               // 修改人id
                    "withdrawalId": "W6419027628808093696",          // 提现id
                    "fees": "0.001000000000000000",                  // 手续费
                    "amount": "10.000000000000000000",               // 提现数量
                    "userApplyWithdrawId": "7eBDJ5PKbSK",            // 提现记录id
                    "verifyRemark": null,                            // 审核意见
                    "remark": null,                                  // 备注
                    "verifyTime": 0,                                 // 审核时间
                    "userName": "994709373@qq.com",                  // 用户名
                    "userId": "7e9ioSoVXcW",                         // 用户id
                    "actuallyAmount": "10.000000000000000000",       // 实际到账数量
                    "modifyTime": 0,                                 // 修改时间
                    "verifyStatus": 0,                               // 审核状态(0 待审核 , 1 审核通过 -1 审核不通过)
                    "createTime": 1530415446577,                    // 提币时间
                    "state": 1,                                                             // 状态(-1 删除, 1 正常)
                    "currencyId": "2",                                                          // 币种id
                    "withdrawalAddress": "1JimMZks39eVqU6T3v6wvz1m4LtJ3tPjGL",                  // 提币地址
                    "verifyUid": null                                                           // 审核人id
                }
            ],
            "pageNum": 1
        },
        "resMsg": {
            "code": "1",
            "method": null,
            "message": "success !"
        }
    }
    

    3.4 获取用户所有资金信息

    path:https://www.xt.com/exchange/fund/controller/website/FundController/findByPage
    请求方式:get
    请求报文

    
    {
        "pageSize":30,       #  每页行数(可选)
        "pageNum":1          #  页码(可选)
    }
    

    返回报文

    {
        "datas": {
            "totalRow": null,
            "totalPage": null,
            "pageSize": 30,
            "list": [
                {
                    "currencyTypeId": 1,                    // 货币类型id
                    "amount": "971.174000000000000000",     // 用户当前可用资金数量
                    "freeze": "122.000000000000000000",     // 用户冻结资金数量
                    "createTime": "2018-02-19 10:02:33",
                    "depositAddress": null,
                    "userId": "1"
                },
                {
                    "currencyTypeId": 2,
                    "amount": "768.368000000000000000",
                    "freeze": "131.000000000000000000",
                    "createTime": "2018-02-19 10:02:33",
                    "depositAddress": null,
                    "userId": "1"
                }
            ],
            "pageNum": 1
        },
        "resMsg": {
            "code": "1",
            "method": null,
            "message": "success !"
        }
    }

    3.5 查询提币地址

    path:https://www.xt.com/exchange/fund/controller/website/FundWebSiteController/getWithdrawAddress
    请求方式:get
    请求报文

    currencyId=2          // (必传)
    pageIndex=1           // (可选, 默认1)
    pageSize=10           // (可选, 默认10)

    返回报文

    {
        "datas": {
            "totalRow": 2,
            "totalPage": 1,
            "pageSize": 10,
            "list": [
                {
                    "address": "1DkwrD4bMtjd6kcZw8CxM9r3z4AGVFfSRz",    // 地址
                    "modifyTime": 1524217688882,                        // 修改时间
                    "currencyName": "btc",                              // 币种名称
                    "createTime": 1523185357488,                        // 提币时间
                    "userFundAddressId": "7bwK95B7jTk",                 // 地址id
                    "remark": "correct",                                // 备注
                    "currencyId": "2",                                  // 币种id
                    "type": 1,                                          // (1-提币地址, 2-打币地址)
                    "userName": "Mr.牛",                                // 用户名
                    "userId": "7e8fMkzTlL6",                            // 用户id
                    "status": "1"                                       // 状态(-1 删除, 1 正常)
                }
            ],
            "pageNum": 1
        },
        "resMsg": {
            "code": "1",
            "method": null,
            "message": "success !"
        }
    }

    4 签名规则

    4.1 签名规则

    签名串sign=md5(Apiid+Timestamp+参数内容拼串+签名秘钥),Timestamp是毫秒为单位的时间戳,签名秘钥为ApiSecret,和Apiid在网站打开Api功能时获取。参数拼串内容规则有三种,只有header参数的为空字符串"" ,body json格式的参数为body参数的json字符串格式,key-value以及get形式的参数内容拼串为所有参数按key值首字母排序后再按key1+value1+key2+value2...的形式拼串。签名后将Apiid、Timestamp、Sign放入到请求header中,注意首字母大写,后面全小写。
    比如在网站打开API功能后拿到下面两个参数 Apiid=7eESLc0x69I7eESLc0x69J,Apisecret = 87ceba599b6d39a39deb01cf71eacd57,Timestamp=1526886847000,
    a、Body json格式参数

     参数内容json字符串为:{"userId":"u111","name":"zhangsan"}
    参数内容拼串为:{"userId":"u111","name":"zhangsan"}
    则 Sign = md5(7eESLc0x69I7eESLc0x69J1526886847000{"userId":"u111","name":"zhangsan"}87ceba599b6d39a39deb01cf71eacd57)
    = 1429945054c993ea3e22a28227bf7b25   

    b、 没有任何body或get参数

     参数内容拼串为空 则
    Sign = md5(7eESLc0x69I7eESLc0x69J152688684700087ceba599b6d39a39deb01cf71eacd57)
    = 735aeffac07c60ddeb2d6f18115c1946 

    c、formdata key-value, 或者get参数

     参数内容为:userid=10,status=1,acount = 10
    参数内容拼串为:account10status1userid10
    则 Sign = md5(7eESLc0x69I7eESLc0x69J1526886847000account10status1userid1087ceba599b6d39a39deb01cf71eacd57)
    = 1d83cb6bde160eff50fbb13a407e7804   

    提供Java版本的签名代码如下,其他语言请参考代码自行实现

    package com.xt.api.demo;
    
    import com.alibaba.fastjson.JSON;
    
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import java.util.HashMap;
    import java.util.Map;
    
    /**
     * @Author: cai.zhenghao
     * @Description:
     * @Date: Created in 2018/6/26   下午3:48
     * @Modified By:
     */
    public class SignUtils {
    
        /**
         * 自行根据需要设置,一般认为一个服务里使用的只有一个
         */
        public static String ID_NAME = "Apiid";
        private static final Integer CLIENT_TYPE = 5;//API调用
    
        /**
         * 不为空、不为空字符串、不为双引号、不为空{}
         *
         * @param source
         * @return
         */
        public static boolean isEmpty(String source) {
            return source == null || source.isEmpty() || source.equals("""") || source.trim().equals("{}");
        }
    
        /**
         * 参数是formdata key value,或者get参数 形式的情况下获取签名header
         *
         * @param parameters
         * @return
         */
        public static Map getHeaderOfKeyValue(String id, String secret, Map parameters) {
            long time = System.currentTimeMillis();
            Map header = new HashMap();
            StringBuffer contentSb = new StringBuffer();
            if (parameters != null) {
                parameters.entrySet().stream()
                        .filter(a -> a != null && (!isEmpty(a.getKey()) || !isEmpty((String) a.getValue()))).
                        sorted(Map.Entry.comparingByKey()).forEachOrdered(e -> contentSb.append(e.getKey() + e.getValue()));
            }
            header.put(ID_NAME, id);
            header.put("Timestamp", String.valueOf(time));
            header.put("Clienttype", "" + CLIENT_TYPE);
            header.put("Sign", encryptMD5(id + time + contentSb.toString() + secret));
            return header;
    
        }
    
        /**
         * 参数为空情况下获取签名header
         *
         * @return
         */
        public static Map getHeaderOfNoParams(String id, String secret) {
            Map header = new HashMap();
            long time = System.currentTimeMillis();
            header.put(ID_NAME, id);
            header.put("Timestamp", String.valueOf(time));
            header.put("Clienttype", "" + CLIENT_TYPE);
            header.put("Sign", encryptMD5(id + time + secret));
            return header;
    
        }
    
        /**
         * 参数是body json形式的情况下获取签名header
         *
         * @param object
         * @return
         */
        public static Map getHeaderOfBodyJson(String id, String secret, Object object) {
            Map header = new HashMap();
            long time = System.currentTimeMillis();
            String params = JSON.toJSONString(object);
    
            header.put(ID_NAME, id);
            header.put("Timestamp", String.valueOf(time));
            header.put("Clienttype", "" + CLIENT_TYPE);
            header.put("Sign", encryptMD5(id + time + params + secret));
            return header;
        }
    
        public static String encryptMD5(String str) {
            System.out.println("params: " + str);
            return digest("MD5", str);
        }
    
        public static String digest(String code, String str) {
            try {
                MessageDigest messageDigest = MessageDigest.getInstance(code);
                messageDigest.reset();
                messageDigest.update(str.getBytes());
                byte[] byteArray = messageDigest.digest();
                StringBuffer md5StrBuff = new StringBuffer();
    
                for (int i = 0; i < byteArray.length; ++i) {
                    if (Integer.toHexString(255 & byteArray[i]).length() == 1) {
                        md5StrBuff.append("0").append(Integer.toHexString(255 & byteArray[i]));
                    } else {
                        md5StrBuff.append(Integer.toHexString(255 & byteArray[i]));
                    }
                }
    
                return md5StrBuff.toString();
            } catch (NoSuchAlgorithmException var6) {
                var6.printStackTrace();
                return null;
            }
        }
    }

    5市场行情类接口

    注意,市场行情类接口的域名和前面几部分HTTP接口不同,不需要签名,header不需要传签名的几个参数。一个IP一分钟内最多只能访问1000次这部分接口,请注意频率控制。

    5.1 所有市场24H市场行情

    这个数据服务端更新速度为10秒一次,不必太过频繁获取
    path:https://kline.xt.com/api/data/v1/tickers
    请求方式:get
    请求报文

    isUseMarketName=true          //必传,选择true则返回的结果中用BTC_USDT这样的市场名替代掉marketId,false则使用marketId

    返回报文分两种格式
    isUseMarketName为fasle时格式如下

    {
        "resMsg": {
            "code": "1",
            "method": null,
            "message": "success !"
        },
        "datas": [
            [
                99,
                "0.0",
                "0",
                "0",
                "0",
                "0.0",
                "[]",
                "9.396",
                "9.08",
                "21469873.428"
            ],
            [
                90,
                "8249994.968",
                "8257720.9458",
                "8207608.58",
                "1080294.9779",
                "0.51",
                "[[1, 8219706.597], [2, 8249994.998]]",
                "7418805.42381067",
                "7418805.425",
                "21469873.428"
            ]
        ]
    }
    

    isUseMarketName为true时格式如下

    {
        "resMsg": {
            "code": "1",
            "method": null,
            "message": "success !"
        },
        "datas": {
            "ETC_USDT": [
                99,
                "0.0",
                "0",
                "0",
                "0",
                "0.0",
                "[]",
                "9.296",
                "9.708",
                "21469873.428"
            ],
            "BTC_KRW": [
                90,
                "8245004.195",
                "8257720.93",
                "8207608.57",
                "1187226.0187",
                "0.45",
                "[[1, 8219706.597], [2, 8245004.125]]",
                "7418805.413",
                "7418805.47",
                "21469873.408"
            ]
        }
    }
    

    数据说明

    [ 市场ID, 最新成交价, 最高价,最低价, 24小时成交量,24小时涨跌幅, 最近6H收盘价列表,买一价,卖一价,24小时成交额(单位是买方币种)]
    

    最近6H收盘价列表按时间顺序排序,数据说明:

    [[序号, 收盘价], [序号, 收盘价], [序号, 收盘价]]
    

    5.2 单个市场24H市场行情

    这个数据服务端更新速度为10秒一次,不必太过频繁获取
    path:https://kline.xt.com/api/data/v1/ticker
    请求方式:get
    请求报文

    marketId=90          //市场id,和市场名传一个即可
    marketName=ETC_USDT          //市场名,和市场id传一个即可
    

    返回报文格式

    {
        "datas": [
            90,
            "8268227.40230003",
            "8268227.40230003",
            "8207608.58629997",
            "1725211.1401",
            "0.73",
            "[[1, 8219706.597], [2, 8266335.7998], [3, 8268227.4023]]",
            "7418805.4126",
            "7418805.4237",
            "21469873.408"
        ],
        "resMsg": {
            "code": "1",
            "method": null,
            "message": "success !"
        }
    }
    
    

    数据说明

    [ 市场ID, 最新成交价, 最高价,最低价, 24小时成交量,24小时涨跌幅, 最近6H收盘价列表,买一价,卖一价,24小时成交额(单位是买方币种)]
    

    最近6H收盘价列表按时间顺序排序,数据说明:

    [[序号, 收盘价], [序号, 收盘价], [序号, 收盘价]]
    

    5.3 K线

    path:https://kline.xt.com/api/data/v1/klines
    请求方式:get
    请求报文

    marketId=90                     //市场id,和市场名传一个即可
    marketName=ETC_USDT             //市场名,和市场id传一个即可
    type=1M                         //K线类型,支持1M,5M,15M,30M,1H,1D,1W 七种类型,分别代表1-30分钟,1小时,1日,1周
    dataSize=5                      //数据量,最多为100

    返回报文格式

    {
        "datas": [
            [
                "K",
                "90",
                "btc_krw",
                "1532181600",
                "8266335.737",
                "8279949.6898",
                "8266003.6894",
                "8269418.0781",
                "492264.06",
                "0.04",
                "1",
                "1H",
                "false"
            ],
            ..........
        ],
        "resMsg": {
            "code": "1",
            "method": null,
            "message": "success !"
        }
    }
    

    数据说明

    [数据类型, 市场ID, 市场名字, 时间戳, 开盘数据, 最高价, 最低价, 收盘价, 成交量, 涨跌幅度, 美元汇率, K线周期, 是否经过转换]
    

    5.4 交易记录

    path:https://kline.xt.com/api/data/v1/trades
    请求方式:get
    请求报文

    marketId=90                     //市场id,和市场名传一个即可
    marketName=ETC_USDT             //市场名,和市场id传一个即可
    dataSize=10                     //数据量,最多为20

    返回报文格式

    {
        "datas": [
            [
                "T",
                "90",
                "1532183063",
                "BTC_KRW",
                "bid",
                "8271173.90",
                "515.50"
            ],
            ..........
        ],
        "resMsg": {
            "code": "1",
            "method": null,
            "message": "success !"
        }
    }
    

    数据说明

    [数据类型, 市场ID, 币种信息, 时间戳, 买卖类型(asks卖bids买), 价格, 量]
    

    5.5 盘口数据(市场深度)

    本接口最多返回买卖50档的盘口数据
    path:https://kline.xt.com/api/data/v1/entrusts
    请求方式:get
    请求报文

    marketId=90                     //市场id,和市场名传一个即可
    marketName=ETC_USDT             //市场名,和市场id传一个即可

    返回报文格式

    {
        "datas": {
            "asks": [
                [
                    "8247657.898",
                    "5.95"
                ],
                [
                    "7418805.435",
                    "4.88"
                ],
                [
                    "7418805.47",
                    "0.01"
                ]
            ],
            "bids": [
                [
                    "0.81945643",
                    "24.32"
                ],
                [
                    "0.847",
                    "2.064"
                ],
                [
                    "0.516",
                    "17.043"
                ]
            ],
            "timestamp": "1532183394"
        },
        "resMsg": {
            "code": "1",
            "method": null,
            "message": "success !"
        }
    }
    

    数据说明

    asks:(卖盘)[[价格, 量]]
    bids:(买盘)[[价格, 量]]
    

    6 接口结果外部和错误码

    失败时返回报文如下

    {
        "datas": null,
        "resMsg": {
            "code": "1000",
            "method": null,
            "message": "param invalid"
        }
    }

    错误码列表:
    配置及基础功能API、获取用户信息接口、交易API、财务资金API

    错误码说明
    1000 系统错误
    1003 无效的参数
    2000 参数错误
    2001 委托价格类型为空
    2002 委托类型错误
    2003 委托价格异常
    2004 市场ID不能为空
    2012 委托信息不存在或状态异常
    2014 缓存中无该该委托单
    2015 委托单已取消或数据库中不存在
    2016 分页index,pageSize参数有误
    2017 交易货币量为空
    2019 委托单ID不能为空
    2020 委托类型不能为空
    2022 交易货币量小于最小值
    2999 内部错误
    6002 授权失效,需要重新登录
    6021 限制提币操作
    6076 交易密码错误,请重新输入
    6095 用户不存在
    6096 无效的参数
    6114 提币地址为空!
    6124 审核失败!
    6126 审核通过
    6115 提交提币申请失败!
    6125 无效的货币类型!
    6130 没有选取币种!
    6894 时间过长,API签名已失效!
    6895 校验API权限失败,接口不属于授权API!
    6896 校验API权限失败,Userid和Apiid不匹配!
    6897 校验API权限失败,请确认是否开启Api权限!
    6898 多次校验API权限失败,请确认是否开启Api权限!
    10012 未知异常!

    行情、盘口数据(市场深度)、k线、交易记录四类API的错误码说明

    错误码说明
    1000 系统错误
    5010 参数错误
    5016 数据不存在
    5017 该市场不存在
    5019 你的IP一分钟内访问次数超过1000次

    币种

    {
        458: "TUR",
        266: "EUSDT",
        443: "JTT",
        433: "BRE",
        432: "GRIN",
        341: "BEAM",
        340: "RISE",
        339: "ALGO",
        338: "LAMB",
        329: "WICC",
        20: "AT",
        321: "ITC",
        322: "LSC",
        320: "ELA",
        74: "QUN",
        8: "HC",
        316: "SHE",
        165: "GXS",
        314: "MAINONT",
        311: "ONT",
        308: "DUSD",
        299: "ESAX",
        293: "EGT",
        290: "NAS",
        45: "GRAM",
        9: "UBTC",
        282: "ATOM",
        268: "LSK",
        267: "LEO",
        243: "BTT",
        254: "LRC",
        253: "STORJ",
        256: "VOLLAR",
        252: "XMR",
        44: "KNC",
        213: "VSYS",
        67: "ELF",
        69: "MTL",
        43: "RCN",
        242: "BTX",
        73: "TRX",
        52: "ABT",
        72: "TRUE",
        27: "HT",
        4: "ZB",
        41: "1ST",
        224: "BLINK",
        49: "GNT",
        56: "SNT",
        54: "CHAT",
        214: "LBTC",
        178: "TUSD",
        28: "BAT",
        132: "PAX",
        77: "KAN",
        34: "DGD",
        112: "BITCNY",
        105: "NEO",
        37: "OMG",
        53: "MANA",
        42: "BTM",
        35: "ZRX",
        219: "WNT",
        218: "XDT",
        208: "STAR",
        32: "AE",
        187: "ZEC",
        161: "BSV",
        153: "SCC",
        152: "FIL",
        143: "XTZ",
        140: "DCR",
        142: "SXC",
        141: "SC",
        131: "DOGE",
        128: "XT",
        10: "QTUM",
        23: "QC",
        111: "XWC",
        82: "BTS",
        104: "DASH",
        106: "XEM",
        91: "XLM",
        90: "XRP",
        7: "EOS",
        81: "BCHABC",
        101: "ADA",
        11: "USDT",
        2: "BTC",
        5: "ETH",
        6: "ETC",
        21: "LTC",
        459: "BNA"
    }

    交易对

    {
        "BTC_USDT": 614,
        "BCHABC_USDT": 615,
        "ETH_USDT": 616,
        "ETC_USDT": 617,
        "LTC_USDT": 618,
        "ADA_USDT": 619,
        "EOS_USDT": 620,
        "XRP_USDT": 621,
        "XLM_USDT": 622,
        "XEM_USDT": 623,
        "DASH_USDT": 624,
        "BTS_USDT": 625,
        "XWC_USDT": 626,
        "BCHABC_BTC": 627,
        "ETH_BTC": 628,
        "ETC_BTC": 629,
        "LTC_BTC": 630,
        "ADA_BTC": 631,
        "EOS_BTC": 632,
        "XRP_BTC": 633,
        "XLM_BTC": 634,
        "XEM_BTC": 635,
        "DASH_BTC": 636,
        "BTS_BTC": 637,
        "XWC_BTC": 638,
        "XT_USDT": 640,
        "XT_BTC": 650,
        "DOGE_USDT": 660,
        "DOGE_BTC": 670,
        "BTC_SXC": 710,
        "SC_SXC": 720,
        "DCR_SXC": 730,
        "XT_SXC": 731,
        "XWC_SXC": 732,
        "XEM_SXC": 733,
        "EOS_SXC": 734,
        "XRP_SXC": 735,
        "XLM_SXC": 736,
        "DOGE_SXC": 737,
        "DASH_SXC": 738,
        "BTS_SXC": 739,
        "LTC_SXC": 740,
        "ADA_SXC": 741,
        "ETC_SXC": 742,
        "ETH_SXC": 743,
        "BCHABC_SXC": 744,
        "XTZ_SXC": 745,
        "SC_USDT": 746,
        "DCR_USDT": 747,
        "SC_BTC": 748,
        "DCR_BTC": 749,
        "QTUM_SXC": 750,
        "QTUM_USDT": 751,
        "QTUM_BTC": 752,
        "USDT_SXC": 753,
        "XTZ_USDT": 754,
        "XTZ_BTC": 755,
        "FIL_SXC": 756,
        "FIL_USDT": 757,
        "FIL_BTC": 758,
        "SCC_SXC": 759,
        "SCC_USDT": 760,
        "BSV_SXC": 762,
        "BSV_USDT": 763,
        "BSV_BTC": 764,
        "ZEC_SXC": 765,
        "ZEC_USDT": 766,
        "ZEC_BTC": 767,
        "AE_SXC": 768,
        "AE_USDT": 769,
        "AE_BTC": 770,
        "STAR_SXC": 771,
        "XDT_SXC": 773,
        "WNT_SXC": 774,
        "BITCNY_SXC": 775,
        "MANA_SXC": 776,
        "KAN_SXC": 777,
        "DGD_USDT": 790,
        "DGD_BTC": 791,
        "NEO_SXC": 792,
        "NEO_USDT": 793,
        "NEO_BTC": 794,
        "OMG_SXC": 795,
        "OMG_USDT": 796,
        "OMG_BTC": 797,
        "DGD_SXC": 798,
        "PAX_SXC": 784,
        "BAT_SXC": 785,
        "BAT_USDT": 786,
        "BAT_BTC": 787,
        "TUSD_SXC": 788,
        "LBTC_SXC": 799,
        "LBTC_USDT": 935,
        "LBTC_BTC": 936,
        "CHAT_SXC": 937,
        "CHAT_USDT": 938,
        "ZRX_SXC": 940,
        "ZRX_USDT": 941,
        "BTM_SXC": 943,
        "BTM_USDT": 944,
        "BTM_BTC": 945,
        "GNT_SXC": 946,
        "SNT_SXC": 947,
        "1ST_SXC": 948,
        "ZB_SXC": 949,
        "HT_SXC": 950,
        "ABT_SXC": 954,
        "BLINK_USDT": 955,
        "TRX_USDT": 970,
        "TRX_SXC": 971,
        "TRX_BTC": 972,
        "BTX_SXC": 956,
        "BTX_USDT": 957,
        "BTX_BTC": 958,
        "ABT_USDT": 959,
        "RCN_SXC": 960,
        "RCN_USDT": 961,
        "MTL_USDT": 964,
        "MTL_BTC": 965,
        "ELF_SXC": 968,
        "ELF_BTC": 973,
        "ELF_USDT": 969,
        "VSYS_SXC": 7000,
        "VSYS_USDT": 7001,
        "VSYS_BTC": 7002,
        "KNC_SXC": 7003,
        "KNC_USDT": 7004,
        "XMR_USDT": 7008,
        "LRC_SXC": 7009,
        "LRC_USDT": 7010,
        "STORJ_SXC": 7012,
        "STORJ_USDT": 7013,
        "BTT_USDT": 7019,
        "LEO_USDT": 7022,
        "LEO_BTC": 7023,
        "LSK_SXC": 7024,
        "LSK_BTC": 7025,
        "ATOM_USDT": 7026,
        "ATOM_BTC": 7027,
        "ATOM_SXC": 7028,
        "UBTC_USDT": 7030,
        "GRAM_SXC": 7032,
        "GRAM_USDT": 7033,
        "NAS_SXC": 7034,
        "NAS_USDT": 7035,
        "LSK_USDT": 7040,
        "ONT_SXC": 7041,
        "ONT_USDT": 7042,
        "ONT_BTC": 7043,
        "GXS_USDT": 7044,
        "GXS_BTC": 7045,
        "DUSD_SXC": 7050,
        "HC_SXC": 7051,
        "HC_USDT": 7052,
        "HC_BTC": 7053,
        "ELA_SXC": 7054,
        "ELA_USDT": 7055,
        "WICC_SXC": 7056,
        "WICC_USDT": 7057,
        "LAMB_USDT": 7058,
        "LAMB_BTC": 7059,
        "BEAM_SXC": 7060,
        "BEAM_USDT": 7061,
        "BEAM_BTC": 7062,
        "LSC_USDT": 7063,
        "RISE_USDT": 7064,
        "QUN_USDT": 7065,
        "ALGO_USDT": 7066,
        "ALGO_BTC": 7067,
        "ITC_SXC": 7068,
        "ITC_USDT": 7069,
        "AT_SXC": 7070,
        "AT_USDT": 7071,
        "BTC_PAX": 7073,
        "ETH_PAX": 7074,
        "BTC_TUSD": 7075,
        "ETH_TUSD": 7076,
        "XWC_XT": 7077,
        "ETH_XT": 7078,
        "GRIN_SXC": 7079,
        "GRIN_USDT": 7080,
        "JTT_USDT": 7082,
        "BNA_USDT": 7083
    }
  • 相关阅读:
    android broadcast小结
    初学设计模式【7】单例模式——sington
    android之Service总结
    现代软件开发实现六面体
    牛顿迭代法求根
    实现顺序表的各种基本运算
    公共的分页类,包含jsp页面
    多项式拟合+高斯消元解方程组
    差商表及牛顿插值
    C#.NET 获取拨号连接 宽带连接
  • 原文地址:https://www.cnblogs.com/bitquant/p/xt.html
Copyright © 2020-2023  润新知