Sign Up Assets {{loginUser.loginName}}
{{showLang}}
  • Exchange
  • Futures
  • Fiat deal
  • Contract competition
  • Bonus Center
  • Rebate
  • Token Ranking
  • Listing Application
  • Strategy Plaza
  • {{showLang}}
  • {{loginUser.loginName}}
  • Sign In
  • Sign Up
Dear ZBG users, you have not opened contract trading account, please open first.
Not now Open
用户API-HTTP接口

HTTPAPI

ZBG provides users with a simple and powerful API, designed to help users quickly and efficiently integrate ZBG trading capabilities into their own applications.If you have any questions, please contact us for technical discussion at QQ group:829230107 , We will provide you the most authoritative answer

CCXT Example: https://github.com/zbgapi/ccxt/

Java Example: https://github.com/zbg-user-api-demo/user_api_demo_java.git

Python Example: https://github.com/zbg-user-api-demo/user_api_demo_py.git

API Domain Name

Domain Name: https://www.zbg.com/

Instructions

Before using these APIs to obtain two parameters, after the website login, launch the API function to get the Api Id and Api Secret.Using these two parameters to have the transaction orders, withdrawals and other advanced privileges, please keep it confidential. All http interfaces need to be signed, and the signing rules are described later.
   签名串:sign=md5(Apiid+Timestamp+参数内容拼串+apisecret)
   Timestamp:毫秒时间戳
   Apiid,apisecret:网站打开Api功能时获取
   参数内容拼串,有三种:
(1)只有header参数的为空字符串"",没有任何body json参数或者key-value参数
(2)body json格式的参数为body参数的json字符串格式
(3)key-value以及get形式的参数内容拼串为所有参数按key值首字母排序后再按key1+value1+key2+value2...的形式拼串 签名完成后放入请求的header中:
header.put("Apiid",id);
header.put("Timestamp", String.valueOf(time));
header.put("Sign", encryptMD5(id + time + 签名串 + secret));      DetailsSignature Rules

1Configuration and Basic Function API

1.1Get Market List

path:https://www.zbg.com/exchange/config/controller/website/marketcontroller/getByWebId
Request method:get/post
Request message

None

Message return success


{
  { "datas": [
    {
      "amountDecimal": 8,//Quantity accuracy
      "minAmount": "0.0001000000",//Minimum quantity
      "buyerCurrencyId": "2",//The buyer's currency
      "priceDecimal": 8,//Price accuracy
      "serverId": "entrust-server-001",//Service ID
      "marketId": "336",//Market id
      "webId": "100", //Site ID
      "modifyTime": 0,
      "sellerCurrencyId": "19",//The seller's currency
      "createTime": 1522400906009,
      "defaultFee": "0.00050000",//Default rate
      "name": "zt_btc",//Market name
      "leverType": "1",//Leverage type: 1 stock 2 margin
      "state": 1,//Status: 1 run, 2 pause(can't place order),0 stop, -1 delete
      "isMining": 0,//1:true,0:false
      "openTime": 1,//Opening time,timestamp in milliseconds
    },
    ....
  ],
  "resMsg": {
    "code": "1",
    "method": null,
    "message": "success !"
  }
}

1.2Get a list of currency details

path:https://www.zbg.com/exchange/config/controller/website/currencycontroller/getCurrencyList
Request method :get/post
Request message

None

Message return success

{
  "datas": [
    {
      "totalNumber": "230000000.00000000",//Total Amount
      "tradeSearchUrl": null,//Transaction enquiry address
      "tokenCoinsId": 0,//If greater than 0 is the token of another currency, otherwise equal to 0
      "minCash": null,
      "tokenName": null,//
      "description": "Bitcoin",//Description
      "arithmetic": null,   //Consensus algorithm
      "dailyDrawLimit": 10000,
      "remark": null,   //
      "isLegalCoin": 0, //Whether it is a fiat coin, such as $ 1 Yes, 0 No
      "outConfigTimes": 0,//
      "timesFreetrial": "0",//
      "hourFreetrial": "0",//
      "inConfigTimes": 6,//
      "alias": "b",//Alias
      "logo": "market-btc.png",//Icon
      "needBlockUrl": 0,//Whether block address is required: 0: No, 1: Yes
      "currencyId": "2",//currency id
      "drawFlag": 1,
      "rechargeFlag": 1,
      "onceDrawLimit": 100,
      "founder": null,
      "drawFee": "0.00100000",
      "blockChainUrl": "https://blockchain.info/tx/", //blockChain query address(block query address)
      "dayFreetrial": "0",
      "marketValue": null,//Total market value
      "minFee": null,
      "teamAddress": null,
      "defaultDecimal": 2,//Currency decimals (accuracy) - lower priority than the configuration in market
      "publishNumber": "14500000.00000000",//Issued
      "isMining": "0",//Provide mining or not
      "name": "btc",//Name
      "limitAmount": null,
      "websiteCurrencyId": "223f4d23232",
      "state": "1",//Status -1 delete 0 disable 1 enable default 1,
      "descriptionEnglish": "<p>The BTC is ...</p>",//English description
      "mark": null//Symbol
    },
    .....
  ],
  "resMsg": {
    "code": "1",
    "method": null,
    "message": "success !"
  }
}

2Get user information interface

2.1Get user information interface

path:https://www.zbg.com/exchange/user/controller/website/usercontroller/getuserinfo
Request method:get/post
Request message

None

Message return success

{
"datas":{
"loginMobileAuth":0,//Whether phone authentication: 0: No, 1: Yes
"googleStatus":0,//Verifying status: 0: No, 1: Under review
"isAlipay":"",//Whether binding Alipay: 0: No, 1: Yes
"loginPwd":"1",//Whether set login password: 0: No, 1: Yes
"externalUidType":null,//Extended user id source type, such as: zb, exx
"isWechat":"",//Whether binding WeChat: 0: No, 1: Yes
"loginAuth":3,//Login authentication (1-login password 2-remote login authentication 4-Google authentication, you can combine any of them, default 3)
"merchantName":"",//Merchant name
"countryCode":+86,//Country code
"loginName":"130***17",//Login name
"loginGoogleAuth":1,//Whether Google authentication: 0: No, 1: Yes
"email":null,//User email
"nickName":"130***17",//User nickname
"isBank":"",//Whether to bind the bank account
"mobileAuth":1,//Whether the phone authentication: 0: No,1: Yes, [2: modification failed, do not pass, -1: under the review]
"mobile":"+86 130***17",//Mobile phone number
"userId":"test6",//User id
"recommendCode":"dGVzdDY=\u000a",//Referral code
"realName":"",//User real name
"withdrawAuth":3,//Withdrawal verification (1-assets password 2-SMS/email verification 4-Google verification code default asset password + SMS / email = 3)
"recommendCount":null,//Number of referrals
"externalUserId":null,//Extended user id, such as zb, a key to save the zb user ID
"mobileStatus":0,//Verifying status: 0: No, 1: Under review
"safePwdAuth":0,//Whether set security password: 0: No, 1: Yes
"googleAuth":1,//Whether Google authentication: 0: No, 1: Yes
"loginEmailAuth":0,//Whether the mailbox authentication: 0: No, 1: Yes
"tradeAuth":1,//Transaction verification (1-never enter the asset password 2-within 6 hours avoid to enter asset password 3-verify the asset password for each transaction)
"status":1//0 (000-initial state) 1 (001-already real-name authentication) 2 (010-already Bank authentication) 3 (011 already real-name and bank authentication)
},
"resMsg":{
"code":"1",
"method":null,
"message":"success !"
}
}

3Transaction API

3.1New delegate:

path:https://www.zbg.com/exchange/entrust/controller/website/EntrustController/addEntrust
Request method:post
Request message format: application/json
Request message:

json
{
  "amount": 0,                          //Order amount
  "rangeType": 0,                       //Comissioned order type, currently only supports current price Commission 0: current price Commission 1: range Commission
  "type": 0,                            //Trading type: 0: Sell 1: Buy
  "marketName": "btc_usdt" ,                     //Market name
  "price": 0                            //Price
}

Return message:

json
{
  "datas":{
    “entrustId”:"E6419466484531482624"  //Comissioned order ID
  },
  "resMsg":{
    "code":"1",                        //1 means success, other error codes check in the instructions
    "method":null,
    "message":"success !"
  }
}

3.2Cancel order

path:https://www.zbg.com/exchange/entrust/controller/website/EntrustController/cancelEntrust
Request method:post
Request message format: application/json
Request message:

json
{
  "entrustId": "E6419466484531482624",  //Comissioned order ID which needs to be cancelled
  "marketName": "btc_usdt"                     //Market name
}

Return message:

Important reminder information: In order to prevent users from mishandling, the price of the order can not be higher than three times the recent transaction price, and the order price of the sell order cannot be lower than one third of the latest transaction price.

json
{
  "datas":null,
  "resMsg":{
    "code":"1",                        //1 means success, other error codes check in the instructions
    "method":null,
    "message":"success !"
  }
}

3.3批量取消委托

path:https://www.zbg.com/exchange/entrust/controller/website/EntrustController/cancelEntrustMore
Request method:post
Request message format: application/json
Request message:

json
{
  "type": "0",  //可不传 Trading Type:0 Sell 1 Buy
  "marketName": "btc_usdt"                     //Market name
  "entrustId": ["E6419466484531482624","E6566597136257916928"],  // Comissioned order ID   可不传,取消当前市场本人的所有委托
}

Return message:

json
{
  "datas":{"cancelNum":2},  //取消笔数
 "resMsg": {
    "code": "1",            //1 means success, other error codes check in the instructions
    "method": null,
    "message": "success !"
  }
}

3.4Inquire On-Going Entrustment

path: https://www.zbg.com/exchange/entrust/controller/website/EntrustController/getUserEntrustRecordFromCache
Request method:get
Request message:

 "marketName": "btc_usdt"                     //Market name

Return message:

json
{
  "datas": [{
    "amount": "1.1",            //Quantity
    "rangeType": "0",            //entrustment type 0 current price 1 interval
    "rangeLowPrice": "null",            //lowest price of interval entrustment
    "rangeHighPrice": "null",            //highest price of interval entrustment
    "totalMoney": "5.555",            //total volume
    "entrustId": "E6437955999037923328",            //Comissioned order ID
    "type": "0",            //0 sell  1 buy  -1 cancel
    "userId": "test6",            //User id
    "completeAmount": "0",            //amount of completed transactions
    "marketId": "336",            //Market id
    "dealTimes": "0",            //times of transaction dealing
    "createTime": "1534928321609",            //time of order
    "price": "5.05",            //unit price
    "completeTotalMoney": "0",            //total volume of completed transactions
    "entrustType": "false",            //entrustment type 0(false)normal 1(true)margin
    "status": "0",            //status: -2unfreezing failed -1insufficient asset 0start 1cancel 2successful 3 part of transaction 4 canceling
  }],
  "resMsg": {
    "code": "1",            //1 means success, other error codes check in the instructions
    "method": null,
    "message": "success !"
  }
}

3.5Paging query history comissioned orders

paht: https://www.zbg.com/exchange/entrust/controller/website/EntrustController/getUserEntrustList
Request method:get
Request message:

marketName: btc_usdt                     //Market name
pageIndex:  1               //Page
pageSize:   20              //Number of display items per page
type:   0              //(optional) delegate type, 0 sell 1 buy -1 cancel
status:   1              //status: -2unfreezing failed -1insufficient asset 0start 1cancel 2successful 3 part of transaction 4 canceling
startDateTime:   1533204010299              //(optional) start time of a delegate order, 13-bit timestamp
endDateTime:   1533204010299              //(optional) start time of a delegate order, 13-bit timestamp

Return message:

json
{
  "datas": [{
    "amount": "1.1",            //Quantity
    "rangeType": "0",            //entrustment type 0 current price 1 interval
    "rangeLowPrice": "null",            //lowest price of interval entrustment
    "rangeHighPrice": "null",            //highest price of interval entrustment
    "totalMoney": "5.555",            //total volume
    "entrustId": "E6437955999037923328",            //Comissioned order ID
    "type": "0",            //0 sell  1 buy  -1 cancel
    "userId": "test6",            //User id
    "completeAmount": "0",            //amount of completed transactions
    "marketId": "336",            //Market id
    "dealTimes": "0",            //times of transaction dealing
    "createTime": "1534928321609",            //time of order
    "price": "5.05",            //unit price
    "completeTotalMoney": "0",            //total volume of completed transactions
    "entrustType": "false",            //entrustment type 0(false)normal 1(true)margin
    "status": "0",            //status: -2unfreezing failed -1insufficient asset 0start 1cancel 2successful 3 part of transaction 4 canceling
  }],,
  "totalPage": "2",            //number of total pages of entrustment records
  "currentPage": "1",            //current page number
  "resMsg": {
    "code": "1",            //1 means success, other error codes check in the instructions
    "method": null,
    "message": "success !"
  }
}

3.6Query the comissioned order record based on the comissioned order ID

path: https://www.zbg.com/exchange/entrust/controller/website/EntrustController/getEntrustById
Request method:get
Request parameters:

marketName:   btc_usdt                      //Market name
entrustId:  E6419443135315070976    // Comissioned order ID to inquiry

Return message:

{
  "datas": [{
    "amount": "1.1",            //Quantity
    "rangeType": "0",            //entrustment type 0 current price 1 interval
    "rangeLowPrice": "null",            //lowest price of interval entrustment
    "rangeHighPrice": "null",            //highest price of interval entrustment
    "totalMoney": "5.555",            //total volume
    "entrustId": "E6437955999037923328",            //Comissioned order ID
    "type": "0",            //0 sell  1 buy  -1 cancel
    "userId": "test6",            //User id
    "completeAmount": "0",            //amount of completed transactions
    "dealTimes": "0",            //times of transaction dealing
    "createTime": "1534928321609",            //time of order
    "price": "5.05",            //unit price
    "completeTotalMoney": "0",            //total volume of completed transactions
    "entrustType": "false",            //entrustment type 0(false)normal 1(true)margin
    "status": "0",            //status: -2unfreezing failed -1insufficient asset 0start 1cancel 2successful 3 part of transaction 4 canceling
  }],,
  "resMsg": {
    "code": "1",            // 1 means success, other error codes check in the instructions
    "method": null,
    "message": "success !"
  }
}

3.7Search all the trading orders according to the trust order ID

path: https://www.zbg.com/exchange/entrust/controller/website/entrustcontroller/getTransactionListByEntrustId
Request method:get
Request parameters:

marketId:   336                      //Market id
entrustId:  E6419443135315070976    // Comissioned order ID to inquiry

Return message:

{
{
  "datas": [
    {
      "transrecordId": "T6476687294064504832",      //Oder ID history
      "marketId": "336",                //Market id
      "webId": "103",       //Site ID
      "masterEntrustId": "E6476687293972230144",    //Maker order ID
      "type": 1,     //0 sell  1 buy  -1 cancel
      "price": "0.046200000000000000",         //unit price
      "totalPrice": "0.046200000000000000",
      "amount": "1.000000000000000000",         //Quantity
      "buyEntrustId": "E6476687293972230144",    //Buyer trust ID
      "buyUserId": "7eKV3uJ93Jo",     //Buyer user ID
      "sellEntrustId": "E6476687217270992896",      //Seller trust ID
      "sellUserId": "7edE6NSsEL2",   //Seller user ID
      "millisTime": 1544162581936,
      "minuteTime": 25736043,
      "buyMarketId": "336",      //Buyer market ID
      "sellMarketId": "336",     //Seller market ID
      "actStatus": 0,
      "buyerFee": "0.001000000000000000",   //Buyer trading commission
      "sellerFee": "0.000046200000000000",   //Seller  trading commission
      "originalWebId": null,
      "status": 0       //status:-2 Buyer fund insufficient   -1 Seller fund insufficient  0 successful
    },
    ....
  ],
  "resMsg": {
    "message": "success !",
    "method": null,
    "code": "1"
  }
}
  }
}

3.8分页查询正在进行的委托

path: https://www.zbg.com/exchange/entrust/controller/website/EntrustController/getUserEntrustRecordFromCacheWithPage
Request method:get
Request parameters:

marketName:   btc_usdt                      //Market name
pageIndex:  1               //Page
pageSize:   20              //Number of display items per page

Return message:

{
  "datas": {
             "entrustList": [{
   "entrustId": "E6483888378201780224",            //Comissioned order ID
   "sequeueId": 6483888378201780224,
   "webId": "103",
   "customerOrderId": null,
   "userId": "test6",                              //User id
   "price": "0.0581",                               //unit price
   "rangeType": 0,                                  //entrustment type 0 current price 1 interval
   "rangeHighPrice": null,                           //highest price of interval entrustment
   "rangeLowPrice": null,                             //lowest price of interval entrustment
   "amount": "22.8249",                             //Quantity
   "totalMoney": "1.32612669",                       //total volume
   "completeAmount": "0",                              //amount of completed transactions
   "completeTotalMoney": "0",                         //total volume of completed transactions
   "dealTimes": 0,
   "type": 0,                                          //0 sell  1 buy  -1 cancel
   "entrustType": 0,                                   //entrustment type 0(false)normal 1(true)margin
   "status": 0,                                      //status: -2unfreezing failed -1insufficient asset 0start 1cancel 2successful 3 part of transaction 4 canceling
   "freezeId": "Z6483888378244132864",
   "marketId": "336",                                //Market id
   "createTime": 1545879454184,
   "originalWebId": "103",
   "originalMarketId": "336",
   "hedgingId": null,
   "tempDealTimes": 0,
   "availabelAmount": "22.8249"
  },
    ...
            ],
  "totalRow": 4,
  "pageNum": 1,
  "pageSize": 3,
  "totalPage": 2         //number of total pages of entrustment records
 },

            }
  "resMsg": {
    "code": "1",            // 1 means success, other error codes check in the instructions
    "method": null,
    "message": "success !"
  }
}

4 Finance API

4.1 Get the deposit address

path:https://www.zbg.com/exchange/fund/controller/website/fundcontroller/getPayinAddress
Request method:post
Request message format: application/json
Request message

{
    “currencyTypeName”:"btc" // Currency type name (required)
}

Return message


{
    "datas": {
        "address": "19cdJwd3j6ArHNhiYoWpN8cJq9ash7WDDC",// Deposit adress
        "wallet": "merchants014"
    },
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    }
}

4.2 Inquiry Deposit Record

path:https://www.zbg.com/exchange/fund/controller/website/fundcontroller/getPayinCoinRecord
Request method:post
Request message format: application/json
Request message

{
    “currencyTypeName”:“qtum”, // Currency type
    “sort”:1 // no param- reverse chronological order,param- chronological order
    "pageNum":1
    "pageSize":20
}

Return message

{
    "datas": {
        "totalRow": 1,  // total row
        "totalPage": 1, // total page
        "pageSize": 20, // amount in each page
        "list": [
            {
                "currencyTypeId": 1,// currency type id
                "depositId": “f3342424”,// deposit key
                "amount": "10.0",// deposit amount
                "confirmTimes": "4",// confirm
                "createTime": "2018-03-10 10:22:09.0",// deposit time
                "depositAddress": "1BKd2sSPYzxC2XHurR6oQWc2wzSx2rZzck",// Deposit adress
                "txId": "6378183001917882368",// trade id
                "userId": "1",// User id
                "status": 1,//' 0:not arrive yet  1:already arrived  '

            }
        ],
        "pageNum": 1
    },
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    }
}

4.3 Inquiry Withdrawal Record

path:https://www.zbg.com/exchange/fund/controller/website/fundwebsitecontroller/getpayoutcoinrecord
Request method:get
Request message

currencyId=1    // currency id (necessary)
tab=all         // (necessary) | all, wait(submitted,not verify yet), success(verified), fail(failed), cancel(user cancel)
pageIndex=1     // selectable, default 1
pageSize=10     // selectable, default 10

Return message

{
    "datas": {
        "totalRow": 34,                                          // total row
        "totalPage": 4,                                          // total page
        "pageSize": 10,                                          // amount in each page
        "list": [
            {
                "modifyUid": null,                               // modify id
                "withdrawalId": "W6419027628808093696",          // withdrawal id
                "fees": "0.001000000000000000",                  // Service Fees
                "amount": "10.000000000000000000",               // withdrawal amount
                "userApplyWithdrawId": "7eBDJ5PKbSK",            // withdrawal record id
                "verifyRemark": null,                            // verify remark
                "remark": null,                                  // remark
                "verifyTime": 0,                                 // verify time
                "userName": "[email protected]",                  // Username
                "userId": "7e9ioSoVXcW",                         // User id
                "actuallyAmount": "10.000000000000000000",       // actual amount
                "modifyTime": 0,                                 // modify time
                "verifyStatus": 0,                               // verify status (0 yet to verify , 1 success -1 fail)
                "createTime": 1530415446577,                    // time
                "state": 1,                                                             // status(-1 cancelled, 1 normal)
                "currencyId": "2",                                                          // currency id
                "withdrawalAddress": "1JimMZks39eVqU6T3v6wvz1m4LtJ3tPjGL",                  // Withdrawal address
                "verifyUid": null                                                           // verify id
            }
        ],
        "pageNum": 1
    },
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    }
}

4.4 Acquire All Assets Information

path:https://www.zbg.com/exchange/fund/controller/website/fundcontroller/findbypage
Request method:post
Request message format: application/json
Request message


{
    "pageSize":30,       #  row in each page(selectable)
    "pageNum":1          #  page number(selectable)
}

Return message

{
    "datas": {
        "totalRow": null,
        "totalPage": null,
        "pageSize": 30,
        "list": [
            {
                "currencyTypeId": 1,                    // currency type id
                "amount": "971.174000000000000000",     // amount of current assets available
                "freeze": "122.000000000000000000",     // amount of assets frozen
                "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 !"
    }
}

4.5 Inquiry Withdrawal Address

path:https://www.zbg.com/exchange/fund/controller/website/fundwebsitecontroller/getwithdrawaddress
Request method:get
Request message

currencyId=2          // (neseccary)
pageIndex=1           // (selectable, default 1)
pageSize=10           // ( selectable, default 10)

Return message

{
    "datas": {
        "totalRow": 2,
        "totalPage": 1,
        "pageSize": 10,
        "list": [
            {
                "address": "1DkwrD4bMtjd6kcZw8CxM9r3z4AGVFfSRz",    // address
                "modifyTime": 1524217688882,                        // modify time
                "currencyName": "btc",                              // currency name
                "createTime": 1523185357488,                        // time
                "userFundAddressId": "7bwK95B7jTk",                 // address id
                "remark": "correct",                                // remark
                "currencyId": "2",                                  // currency id
                "type": 1,                                          // (1-withdrawal address, 2-deposit address)
                "userName": "Mr.牛",                                // Username
                "userId": "7e8fMkzTlL6",                            // User id
                "status": "1"                                       // status(-1 cancelled, 1 normal)
            }
        ],
        "pageNum": 1
    },
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    }
}

4.6 Withdraw

https://www.zbg.com/exchange/fund/controller/website/fundwebsitecontroller/doPayoutCoin
Request method:post
Request message

{
"amount": 1         // Quantity
"currencyName":"btc"           // Currency
"address":  "oxdfdaidfdfasdfasdfasdfas"         // address
}

Return message

{
    "datas": {
       withdrawId:"11111"       // Withdraw ID
    },
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    }
}

4.7 取消提币

https://www.zbg.com/exchange/fund/controller/website/fundwebsitecontroller/doCancelPayout
Request method:get
Request message

userApplyWithdrawId=111111         // Withdraw ID

Return message

{
    "datas": null
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    }
}

5 Signature Rules

5.1 Signature Rules

The signature string sign=md5 (Apiid+Timestamp+ parameter content string + signature secret key); the signature secret key is Api Secret, and Apiid will be acquired by enabling Api function on the website. There are three parameter string content rules: empty string ''"" when header param only, JSON string format for body JSON format parameter, key-value, and GET string param format for all params sorted according to the initial value of the key value and then spelled in the form of key1+value1+key2+value2... After signing, put Apiid, Timestamp, Sign into the header requested, pay attention to the initial capitalization and the whole lowercase.
Eg: open the API function on the website to get the following two parameters, Apiid=7eESLc0x69I7eESLc0x69J, Apisecret = 87ceba599b6d39a39deb01cf71eacd57, Timestamp=1526886847000,
a, Body JSON format parameters

 Param content json character string:{"userId":"u111","name":"zhangsan"}
Param conten collage string:{"userId":"u111","name":"zhangsan"}
Then Sign = md5(7eESLc0x69I7eESLc0x69J1526886847000{"userId":"u111","name":"zhangsan"}87ceba599b6d39a39deb01cf71eacd57)
= 1429945054c993ea3e22a28227bf7b25   

b、 No body or get param

 The parameter content string is empty Then
Sign = md5(7eESLc0x69I7eESLc0x69J152688684700087ceba599b6d39a39deb01cf71eacd57)
= 735aeffac07c60ddeb2d6f18115c1946 

c、formdata key-value, Or get parameters

 The parameter content is:userid=10,status=1,acount = 10
Param conten collage string:account10status1userid10
Then Sign = md5(7eESLc0x69I7eESLc0x69J1526886847000account10status1userid1087ceba599b6d39a39deb01cf71eacd57)
= 1d83cb6bde160eff50fbb13a407e7804   

Java version of the signature code as follows, please refer to the code in other languages to achieve their own

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   pm3:48
 * @Modified By:
 */
public class SignUtils {

    /**
     *  If you need to set it up, it is generally considered to be the only one used in a service
     */
    public static String ID_NAME = "Apiid";

    /**
     *  Not empty, not empty string, not double quotes, not empty{}
     *
     * @param source
     * @return
     */
    public static boolean isEmpty(String source) {
        return source == null || source.isEmpty() || source.equals("\"\"") || source.trim().equals("{}");
    }

    /**
     *  The parameter is either formdata key value, or the GET parameter is in the form of a signature header
     * @param parameters
     * @return
     */

    public static Map getHeaderOfKeyValue(String id, String secret,Map<String, Object> parameters) {
            long time = System.currentTimeMillis();
            Map header = new HashMap();
            StringBuffer contentSb = new StringBuffer();
            parameters = new TreeMap<>(parameters);
            Iterator it = parameters.entrySet().iterator();
            while(it.hasNext()){
                Map.Entry entry = (Map.Entry)it.next();
                contentSb.append(entry.getKey()).append(entry.getValue());
            }

            header.put(ID_NAME,id);
            header.put("Timestamp", String.valueOf(time));
            header.put("Sign", encryptMD5(id + time + contentSb.toString() + secret));
            return header;
        }

    /**
     *  Get the signature header if the parameter is empty
     * @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("Sign", encryptMD5(id + time + secret));
        return header;

    }

    /**
     *  Get the signature header if the parameter is body json format 
     * @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("Sign", encryptMD5(id + time + params + secret));
        return header;
    }

    public static String encryptMD5(String 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;
        }
    }
}

6 External of Interface and Error Code

Failed return message

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

Error Code List:
For configuration and basic function API, acquire interface of user information, transaction API, finance API

Error Code Description English Description
999 签名错误 sign is invalid!
1000 系统错误 system error
1001 下单频率超过限制 request limit
1003 无效的参数 param invalid
2000 参数错误 parameter error
2001 委托价格类型为空 entrust price range type null
2002 委托类型错误 rangeType [ 0,1] error
2003 委托价格异常 entrust price abnormal
2004 市场ID不能为空 market id null
2008 买卖类型不能为空 type[ buy :type=1 or sell: type=0] null
2009 买卖类型错误 type[ buy :type=1 or sell: type=0] error
2012 委托信息不存在或状态异常 entrust not exists or status abnormal
2014 缓存中无该该委托单 entrust not exists in cache
2015 委托单已取消或数据库中不存在 entrust already canceled or not exists in database
2016 分页index,pageSize参数有误 paging:index or pageSize invalid
2017 交易货币量为空 entrust amount null
2018 交易货币量异常 entrust amount abnormal
2019 委托单ID不能为空 entrustId null
2020 委托类型不能为空 entrustType null
2021 委托类型错误 entrustType [ 0,1] error
2022 交易货币量小于最小值 entrust amount low min limit
2023 委托正在处理 entrust still on dealing, cancel it later
2024 价格过大或过小 entrust price too big or too small
2026 用户委托单数超过最大值 user entrust amount exceed maxnum
2027 市场暂停 this market is suspended
2999 内部错误 system error
6000 参数缺失 Param Missing
6002 授权失效,需要重新登录 Authorization invalid, please sign in again.
6021 限制提币操作 Limit the withdraw operation
6040 该账户已冻结,暂时不能操作 The account has been frozen and can not be operated for the time being
6074 该用户未实名认证 The user is not identified
6075 该用户未银行认证 This user has not bank identified
6076 安全密码错误,请重新输入 Security password error, please enter again!
6095 用户不存在 User does not exist
6096 无效的参数 Invalid parameter
6098 用户已经被列入交易黑名单不能进行交易 The user has been listed on the transaction blacklist and cannot transaction
6114 提币地址为空 Please select a currency address!
6115 提交提币申请失败 Submit a withdrawal application failure!
6124 审核失败 Audit failure!
6125 无效的货币类型 An invalid currency type!
6126 审核通过 Audit Approve!
6130 没有选取币种 No selection of currency, Please try again!
6400 当前市场未到开盘时间 This market is not open!
6894 时间过长,API签名已失效 The time is too long,sign for api is invalid now!
6895 校验API权限失败,接口不属于授权API Failed to verify the API permission. This interface is not a authorize API!
6896 校验API权限失败,Userid和Apiid不匹配 Failed to verify the API permission. The Userid is not matching with Apiid!
6897 校验API权限失败,请确认是否开启Api权限 Failed to verify the API permission. Please confirm whether to enable API permission!
6898 多次校验API权限失败,请确认是否开启Api权限 Failed to verify the API permission for multiple times. Please confirm whether to enable API permission!
6899 该市场现暂不对外开放api交易 The market is temporarily not open to API trading!
6900 交易所现暂不对外开放api交易 The exchange server temporarily not open to API trading!
10012 未知异常 unknown error

For quotations, market data (market depth), k line and trading history

Error Code Description English Description
1000 系统错误 system error
5010 参数错误 param is invalid
5016 数据不存在 rdata not exist
5017 该市场不存在 market not exist
5019 你的IP一分钟内访问次数超过1000次 your ip has been accessed more than 1000 times a minute
ZBGqueue-orderGuide