NAV
English 中文
shell

Introduction

BitZ provides you with a simple and powerful API interface to help you obtain market information and conduct transactions efficiently.

BitZ provides you with a simple and powerful API interface to help you get market quotes and trades quickly and efficiently.

Before using the trading API, please create an API in the User Center, get your API Key and Secret, and set the API's IP access restrictions.

Homepage: Official website 1 Official website 2

Change Log

Release Time API Type Description
2020.08.04 /Trade/addEntrustSheetBatch update Password parameters are no longer required(tradePwd)
2020.08.04 /Trade/addEntrustSheet update Password parameters are no longer required(tradePwd)

Access

Domain

https://apiv2.bitz.com

https://apiv2.bit-z.pro

https://api.bitzapi.com

https://api.bitzoverseas.com

https://api.bitzspeed.com

Limit

Rate limit of all interfaces
Rate Limit Category:Ip、Uid、Apikey
Limit frequency: no more than 5000 times within 1 min

Rate limit of single interface
Rate Limit Category:Uid、Apikey
Limit frequency: no more than 30 times within 1 sec

signature Authentication

Authentication

The API request may be tampered during internet, therefore all private API must be signed by your API Key (Secrete Key). Each API Key has permission property. Permission types are divided into: read, transaction, withdraw. please check the API permission, and make sure your API key has proper permission.

Parts

GET Example Current Fiat currency exchange rate information interface; symbols is the transaction pair parameter required by the interface ( Also required for authentication)

curl "https://apiv2.bitz.com/V2/Market/currencyRate?\
accessKey=dca69b225ef11f9105275da52cc560cf\
&timestamp=2019-11-21T08%3A20%3A58\
&signature=P0ctuNHKJTHHEUPd3t0dRAbrm8RBR8ufbT2chgvIF4s%3D\
&symbols=cny_usdt%2Ceur_jpy\
"

POST Example Cancel limit order interface; order-id is the Order id parameter required by the interface ( Also required for authentication)

curl "https://apiv2.bitz.com/V2/Trade/cancelEntrustSheet?\
accessKey=dca69b225ef11f9105275da52cc560cf\
&timestamp=2019-11-21T08%3A20%3A58\
&signature=P0ctuNHKJTHHEUPd3t0dRAbrm8RBR8ufbT2chgvIF4s%3D\
&order-id=12345654321\
-X POST\
-d order-id=12345654321\
"

API Path: apiv2.bitz.com, for example apiv2.bitz.com/V2/Market/currencyRate.

API Access Key(accessKey):The 'Access Key' in your API key

timestamp:The UTC time when the request is sent, e.g. 2017-05-11T16:22:06. It is useful to prevent the request to be intercepted by third-party.

Parameters: Each API Method has a group of parameters, you can refer to detailed document for each of them. For GET request, all the parameters must be signed. For POST request, the parameters needn't be signed and they should be put in request body.

signature: The value after signed, it is guarantee the signature is valid and the request is not be tempered.

Create APIKEY

Create API Key You can manage your API Key Here

API Key Information

Method

The signature may be different if the request text is different, therefore the request should be normalized before signing.

https://apiv2.bitz.com/V2/Market/currencyRate?

accessKey=dca69b225ef11f9105275da52cc560cf

&timestamp=2019-11-21T08%3A20%3A58

&signature=P0ctuNHKJTHHEUPd3t0dRAbrm8RBR8ufbT2chgvIF4s%3D

&symbols=cny_usdt%2Ceur_jpy

1. Parameter Code

symbols=cny_usdt%2Ceur_jpy

accessKey=dca69b225ef11f9105275da52cc560cf

timestamp=2019-11-21T08%3A20%3A58

2. Parameter Order

accessKey=dca69b225ef11f9105275da52cc560cf

timestamp=2019-11-21T08%3A20%3A58

symbols=cny_usdt%2Ceur_jpy

3. Use char “&” to concatenate all parameters

accessKey=dca69b225ef11f9105275da52cc560cf&timestamp=2019-11-21T08%3A20%3A58&symbols=cny_usdt%2Ceur_jpy

4. Generate a signature

P0ctuNHKJTHHEUPd3t0dRAbrm8RBR8ufbT2chgvIF4s%3D

5. Put the signature into request URL

https://apiv2.bitz.com/V2/Market/currencyRate?

accessKey=dca69b225ef11f9105275da52cc560cf

&timestamp=2019-11-21T08%3A20%3A58

&signature=P0ctuNHKJTHHEUPd3t0dRAbrm8RBR8ufbT2chgvIF4s%3D

&symbols=cny_usdt%2Ceur_jpy

Request format

The API is restful and there are two method: GET and POST.

GET request: All parameters are included in URL POST request: All parameters are formatted as JSON and put int the request body

Response Format

The response is JSON format.There are four fields in the top level:"status", "msg", "time", "microtime", "source". The first three fields indicate the general status, the business data is is under "data" field.

Field Data Type Description
status int Status of API response
msg string Message
time int Time
microtime string Time(Microsecond)
source string Source
data object The body data in response

Usage

Source code download address:

https://github.com/api-demo-file/api-v2-sign-demo/

Basic Information

Get current fiat currency exchange rate information

example of CURL

curl "https://apiv2.bitz.com/V2/Market/currencyRate?\
symbols=cny_usdt%2Ceur_jpy\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "cny_usdt": {       // trading pair
      "coin": "cny",    // coin
      "currencyCoin": "usdt",       // currency coin
      "rate": "0.146471",           // exchange rate
      "rateTime": "2018-08-03 23:29:03",    // rate time
      "ratenm": "cny/usdt",         // rate name
      "flatform": "api.k780.com",   // platform
      "created": "1533461732",      // timestamp
      "timezone": "PRC"             // time zone
    },
    "usdt_cny": {
      "coin": "usdt",
      "currencyCoin": "cny",
      "rate": "6.853000",
      "rateTime": "2018-08-03 23:29:03",
      "ratenm": "usdt/cny",
      "flatform": "api.k780.com",
      "created": "1533559242",
      "timezone": "PRC"
    }
  }
}

GET /V2/Market/currencyRate

Parameters

Parameter Required Type Comment
symbols false string cny_usdt,usdt_cny Return the specified data when incoming, separated by comma, otherwise return all

Response Content

Field Required Type Comment
coin true string coin
currencyCoin true string currency coin
rate true string exchange rate
rateTime true string rate time
ratenm true string rate name
flatform true string platform
created true string timestamp
timezone true string time zone

Get fiat currency exchange rate information

example of CURL

curl "https://apiv2.bitz.com/V2/Market/currencyCoinRate?\
coins=coins=btc%2Cusdt\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "btc": {
      "dkkt": "47619.53224133",
      "usdt": "7392.98000000",
      "eth": "17.85045531",
      "bz": "54141.85165132",
      "cny": "50474.01874773",
      "jpy": "822173.04270462",
      "krw": "7850869.56521739",
      "usd": "7392.98000000",
      "dkk": "47619.53224133",
      "btc": "1"
    },
    "usdt": {
      "btc": "0.00014298",
      "dkkt": "6.45648650",
      "eth": "0.00245718",
      "bz": "7.72797527",
      "usdt": "1",
      "cny": "6.85382169",
      "jpy": "111.50758251",
      "krw": "1114.82720178",
      "dkk": "6.45648650",
      "usd": "1"
    }
  }
}

GET /V2/Market/currencyCoinRate

Parameters

Parameter Required Type Comment
coins False string btc,usdt Return the specified data when incoming, separated by comma, otherwise return all

Get currency exchange rate

example of CURL

curl "https://apiv2.bitz.com/V2/Market/coinRate?\
coins=btc%2Ceth\
"

Payload

{
    "status": 200,
    "msg": "",
    "data": {
        "btc": {
            "btc": "1",
            "usdt": "9490.0300000000",
            "eth": "36.1630824832",
            "trx": "533304.8904058450",
            "bz": "86132.6442721791",
            "dkkt": "60927.3137147383",
            "cny": "66392.2498800000",
            "jpy": "1016572.0136000000",
            "krw": "11358616.9070000000",
            "eur": "8180.4058600000",
            "sgd": "13119.9664750000",
            "rub": "673811.1100600000",
            "usd": "9490.0300000000"
        },
        "eth": {
            "eth": "1",
            "btc": "0.0276525100",
            "usdt": "262.4650000000",
            "trx": "14754.7030616008",
            "bz": "2381.7843041843",
            "dkkt": "1685.0517041264",
            "cny": "1836.2051400000",
            "jpy": "28115.2508000000",
            "krw": "314144.3585000000",
            "eur": "226.2448300000",
            "sgd": "362.8578625000",
            "rub": "18635.5399300000",
            "usd": "262.4650000000"
        }
    },
    "time": 1595487121,
    "microtime": "0.44669800 1595487121",
    "source": "api"
}

GET /V2/Market/coinRate

Parameters

Parameter Required Type Comment
coins string btc,eth Return the specified data when incoming, separated by comma, otherwise return all

Get current server time

example of CURL

curl "https://apiv2.bitz.com/V2/Market/getServerTime"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": []
}

GET /V2/Market/getServerTime

Wallet (Deposit and Withdraw)

Query Deposit Address

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/getCoinAddress\
-X POST\
-d currency=eth\
"

Payload

{
    "status": 200,
    "msg": "",
    "data": {
        "address": "0xed95eaf08***********ac936b8c702" // deposit address
    },
    "time": 1582525979,
    "microtime": "0.55819500 1582525979",
    "source": "api"
}

Payload (eos)

{
    "status": 200,
    "msg": "",
    "data": {
        "memo": "2******8",       // Deposit memo
        "address": "b******sit1"  // Deposit address
    },
    "time": 1582526057,
    "microtime": "0.06580900 1582526057",
    "source": "api"
}

POST /V2/Trade/getCoinAddress

Parameters

Parameter Required Type Comment
currency True string currency name
type Optional string type, usdt requested,accepted value: erc20,omni,trc20

Response Content

Field Required Type Comment
memo false string Deposit memo
address true string Deposit address

Query withdraw address

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/getCoinAddressList\
-X POST\
-d currency=eth\
"

Payload

{
    "status": 200,
    "msg": "",
    "time": 1579165863,
    "microtime": "0.31119300 1579165863",
    "source": "api",
    "data": {
        "wallet": [
            {
                "name": "withdrawETH",  // wallet name
                "address": "0x30056a9d28f768aa0363604660301481b30e5f34",  // blockchain withdraw address
                "currency": "eth",      // currency
                "chain": "",            // chain mark
                "memo": ""              // MEMO mark
            }
        ]
    }
}

POST /V2/Trade/getCoinAddressList

Parameters

Parameter Required Type Comment
currency true string currency name

Response Content

Field Required Type Comment
name true string wallet name
address true string blockchain withdraw address
currency true string currency
chain true string chain mark
memo true string MEMO mark

Create a Withdraw Request

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/coinOut\
-X POST\
-d currency=btc\
&amount=10\
&address=xxx\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "id": "196979",         // Only identifier for withdraw
    "email": "*****@email.com",   // email
    "coin": "btct",         // coin
    "netwark_fee": "",      // network fee
    "eid": "23112"          
  }
}

POST /V2/Trade/coinOut

Parameters

Parameter Required Type Comment
currency true string currency name
amount true float amount
address true string address
memo optional string memo
type optional string type, usdt needed, accepted value erc20,omni,trc20

Response Content

Field Required Type Comment
id true string Only identifier for withdraw
email true string email
coin true string coin
netwark_fee true string network fee

Search for Existed Withdraws and Deposits

POST /V2/Trade/depositOrwithdraw

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/depositOrwithdraw\
-X POST\
-d currency=btc\
&page=1\
&size=10\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "data": [       // data
      {
        "id": "397574",   // only identifier for data
        "uid": "2033056", // only identifier for user
        "address": "1AG1gZvQAYu3WBvgg7p4BMMghQD2gE693k",    // withdraw address   
        "txHash": "",                    // withdraw hash
        "confirm": "0",                   // confirmation number
        "amount": "1000.00000000",        // amount
        "status": 1,                      // status 
        "updatedAt": "0",                // Update time (stamp)
        "addressUrl": "http://omniexplorer.info/lookupadd.aspx?address=",   // Blockchain address status query
        "txidUrl": "http://omniexplorer.info/lookuptx.aspx?txid=",          // Blockchain transaction status query
        "description": "Tether",          // description
        "currency": "usdt",               // coin
        "memo": ""                        // memo
      }
    ],
    "pageInfo": {             // page information
      "limit": "10",          // number of records
      "offest": "0",          // initial position
      "current_page": 1,      // current page
      "page_size": 10,        // size of per page
      "total_count": 2,       // total number of records
      "page_count": 1         // total number of pages
    }
  }
}

Parameters

Parameter Required Type Comment
currency true string coin
type true integer 1:deposit,2:withdraw
page false integer current page
size false integer Number of records per page max 100
startTime false string begin timestamp
endTime false string end timestamp

Response Content

data

Field Required Type Comment
id true string only identifier for data
uid true string only identifier for user
address true string withdraw address
txHash true string withdraw hash
confirm true string confirmation number
amount true string amount
status true string status
updatedAt true string Update time (stamp)
addressUrl true string Blockchain address status query
txidUrl true string Blockchain transaction status query
description true string description
currency true string coin
memo true string memo

pageInfo

Field Required Type Comment
limit true int number of records
offest true int initial position
current_page true int current page
page_size true int size of per page
total_count true int total number of records
page_count true int total number of pages

status deaciption

symbol description
1 unconfirmed
2 under vertification
3 waiting
4 finished
5 cancel

Currency Market View

Get the price data

example of CURL

curl "https://apiv2.bitz.com/V2/Market/ticker?\
symbol=eth_btc\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1579246083,
  "microtime": "0.10447900 1579246083",
  "source": "api",
  "data": {
    "symbol": "btc_usdt",       // trading pair
    "vol": "0.00",              // volume
    "amount": "0.00",           // amount
    "priceChange24h": "0.00",   // Price fluctuation percentage
    "open": "5000.00",          // opening price
    "high": "9999.99",          // highest price
    "low": "1.00",              // lowest price
    "now": "5000.00",           // current price
    "firstId": 9091334076,      // first order
    "lastId": 9091334076,       // last order
    "count": 34,                // Number of transactions
    "numberPrecision": 2,       // number precision
    "pricePrecision": 2,        // price precision
    "cny": "34357.50",          // cny exchange rate
    "usd": "5000.00",           // usd exchange rate
    "krw": "5791700.00",        // krw exchange rate
    "jpy": "551150.00",         // jpy exchange rate
    "rub": "308187.50",         // rub exchange rate
    "ask": [
      "8928.53",                // best ask price
      "0.7000"                  // amount of best ask price
    ],
    "bid": [
      "8928.63",                // best bid price
      "1.7000"                  // amount of best bid price
    ]
  }
}

GET /V2/Market/ticker

Parameters

Parameter Required Type Comment
symbol true string eth_btc、ltc_btc trading pair

Response Content

Field Required Type Comment
symbol true string trading pair
vol true string volume
amount true string amount
priceChange24h true string Price fluctuation percentage
open true string opening price
high true string highest price
low true string lowest price
now true string current price
firstId true int first order
lastId true int last order
count true int Number of transactions
numberPrecision true int number precision
pricePrecision true int price precision
cny true string cny exchange rate
usd true string usd exchange rate
krw true string krw exchange rate
jpy true string jpy exchange rate
rub true string rub exchange rate
ask true array best ask price,amount of best ask price
bid true array best bid price,amount of best bid price

Get Market Depth

example of CURL

curl "https://apiv2.bitz.com/V2/Market/depth?\
symbol=eth_btc\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1532671014,
  "microtime": "0.49301600 1532671014",
  "source": "api",
  "data": {
    "asks": [   // sell
      [
        "57.70000000",      // price
        "1.6783",           // number
        "96.837910000000"   // total price
      ],
    ],
    "bids": [  // buy
      [
        "0.00121238",       //price
        "1398.9960",        //number
        "1.696114770480"    //total price
      ],
    ],
    "coinPair": "ltc_btc"   // trading pair
  }
}

GET /V2/Market/depth

Parameters

Parameter Required Type Comment
symbol true string eth_btc、ltc_btc trading pair

Response Content

Field Required Type Comment
asks true array price,number,total price(sell)
bids true array price,number,total price(buy)
coinPair true array trading pair

Get the order

example of CURL

curl "https://apiv2.bitz.com/V2/Market/order?\
symbol=eth_btc\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": [
    {
      "id": 105526523,
      "t": "12:58:48",    // time
      "T": 1535796654,
      "p": "0.01053000",  // price
      "n": "11.9096",     // number
      "s": "buy"          // type buy/sell
    }
  ]
}

GET /V2/Market/order

Parameters

Parameter Required Type Comment
symbol true string eth_btc、ltc_btc trading pair

Response Content

Field Required Type Comment
t true string time
p true string price
n true string number
s true string type buy/sell

Get the price of all symbol

example of CURL

curl "https://apiv2.bitz.com/V2/Market/tickerall?\
symbols=eth_btc\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "777_btc": {
      "symbol": "777_btc",
      "vol": "2.5926",            // volume
      "volume": "2120645.6004",   // amount
      "priceChange24h": "-4.83",  // Price fluctuation percentage
      "ask": [
        "0.01029941",             // best ask price
        "1.6702"                  // amount of best ask price
      ],
      "bid": [
        "0.01029941",             // best bid price
        "1.6702"                  // amount of best bid price
      ],
      "open": "0.00000118",       // opening price
      "high": "0.00000130",       // highest price
      "low": "0.00000109",        // lowest price
      "now": "0.00000124",        // current price
      "firstId": "105551102",     // first order
      "lastId": "105853063",      // last order
      "count": "2650",            // Number of transactions
      "numberPrecision": "4",     // number precision
      "pricePrecision": "8",      // price precision
      "cny": "0.06912764",
      "usd": "0.01014551",
      "krw": "6.35"
    }
  }
}

GET /V2/Market/tickerall

Parameters

Parameter Required Type Comment
symbols false string eth_btc,ltc_btc trading pair,return the specified data when it is passed in, separated by comma, otherwise return all

Response Content

Field Required Type Comment
vol true string volume
volume true string amount
priceChange24h true string Price fluctuation percentage
ask true array best ask price,amount of best ask price
bid true string best bid price,amount of best bid price
open true string opening price
high true string highest price
low true string lowest price
now true string current price
firstId true string first order
lastId true string last order
count true string Number of transactions
numberPrecision true string number precision
pricePrecision true string price precision

Get kline data

example of CURL

curl "https://apiv2.bitz.com/V2/Market/kline?\
symbol=eth_btc\
period=30min\
size=10\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "period": "1mon",           // return the data time interval of each point
    "symbol": "eos_btc",        // trading pair
    "to": "1506700800000",      // time
    "size": "300",              // return the number of K-line data
    "bars": [
      {
        "id": "1530288000000",      // timestamp, in millisecond, and use this as the id of this bar
        "open": "0.00127236",       //  opening price at this stage
        "high": "0.00159900",       //  highest price at this stage
        "low": "0.00120082",        //  lowest price at this stage
        "close": "0.00120148",      // closing price at this stage
        "amount": "539601.23460000",// volume
        "datetime": "2018-06-30 00:00:00"
      }
    ]
  }
}

GET /V2/Market/kline

Parameters

Parameter Required Type Comment
size false integer get number range: 1-300
startTime false string millisecond. Return the data after this millisecond
endTime false string millisecond. Return the data before this millisecond
symbol true string eth_btc、ltc_btc trading pair
period true string 1min 、5min 、15min 、30min 、60min、 4hour 、 1day 、5day 、1week、 1mon

Response Content

Field Required Type Comment
period true string return the data time interval of each point
symbol true string trading pair
to true string time
size true string return the number of K-line data

bars

Field Required Type Comment
id true string timestamp, in seconds, and use this as the id of this bar
open true string opening price at this stage
high true string highest price at this stage
low true string lowest price at this stage
close true string closing price at this stage
amount true string volume

Get Data of Trading Pairs

example of CURL

curl "https://apiv2.bitz.com/V2/Market/symbolList?\
symbols=eth_btc\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1579248124,
  "microtime": "0.62609500 1579248124",
  "source": "api",
  "data": {
    "eth_btc": {
      "id": "15",
      "symbol": "eth_btc",      // trading pair
      "baseCurrency": "eth",
      "quoteCurrency": "btc",
      "amountPrecision": "4",   // amount precision
      "pricePrecision": "8",    // price precision
      "status": "1",
      "minOrderAmt": "0.001",           // min amount of a single order
      "maxOrderAmt": "500000000.000",   // max amount of a single order
      "marketBuyFloat": "4"     // market buy precision
    }
  }
}

GET /V2/Market/symbolList

Parameters

Parameter Required Type Comment
symbols false string eth_btc,ltc_btc trading pair, return the specified data when it is passed in, separated by comma, otherwise return all

Response Content

Field Required Type Comment
symbol true string trading pair
amountPrecision true string amount precision
pricePrecision true string price precision
minOrderAmt true string min amount of a single order
maxOrderAmt true string max amount of a single order
marketBuyFloat true string market buy precision

Exchange Trading

Submit limit order

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/addEntrustSheet\
-X POST\
-d type=2\
&price=8500\
&amount=1\
&symbol=btc_usdt\
"

Payload

{
    "status": 200,
    "msg": "",
    "time": 1579505907,
    "microtime": "0.41723500 1579505907",
    "source": "api",
    "data": {
        "orderId": 1036049896,  // order id
        "accountId": 70001018,  // uid
        "price": "8500.00",     // price
        "amount": "1.00",       // number
        "numberOver": "1.00",   // unfilled amount
        "flag": "sale",         // flag
        "status": 0,            // 0 not filled 1 partial filled 2 all filled 3 canceled
        "coinFrom": "btc",      // The currency to be exchanged
        "coinTo": "usdt",       // Target exchange
        "fieldAmount": 0        // filled amount
    }
}

POST /V2/Trade/addEntrustSheet

Parameters

Parameter Required Type Remarks
type True string type 1 buy 2 sell
price True float order price
amount True float order amount
symbol True string trading pair eth_btc,etc.

Response Content

Field Required Type Comment
orderId True int order id
accountId True int user id
price True string price
amount True string number
numberOver True string unfilled amount
flag True string flag
status True int 0 not filled 1 partial filled 2 all filled 3 canceled
coinFrom True string The currency to be exchanged
coinTo True string Target exchange
fieldAmount True float filled amount

Submit market order

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/marketTrade\
-X POST\
-d type=2\
&amount=1\
&symbol=btc_usdt\
"

Payload

{
    "status": 200,
    "msg": "",
    "time": 1579506291,
    "microtime": "0.96183900 1579506291",
    "source": "api"
    "data": {
        "orderId": 1036051145,  // order id
        "accountId": 70001018,  // uid
        "price": null,          // price
        "amount": "1.00",       // amount
        "numberOver": "1.00",   // unfilled amount 
        "flag": "sale",         // trading type
        "status": 0,            // 0 not filled 1 partial filled 2 all filled 3 canceled
        "coinFrom": "btc",      // The currency to be exchanged
        "coinTo": "usdt",       // Target exchange
        "numberDeal": 0,        // filled amount
        "total": null           // total amount
    }
}

POST /V2/Trade/marketTrade

Parameters

Parameter Required Type Remarks
symbol true string trading pair eth\btc,etc.
amount true string Incoming amount for purchase, incoming quantity for sale
type true int type 1 buy 2 sell

Response Content

Field Required Type Comment
orderId True int order id
accountId True int user id
price True string/null price
amount True string amount
numberOver True string unfilled amount
flag True string trading type
status True int 0 not filled 1 partial filled 2 all filled 3 canceled
coinFrom True string The currency to be exchanged
coinTo True string Target exchange
numberDeal True float filled amount
total True string/null total amount

Submit batch limit orders

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/addEntrustSheetBatch\
-X POST\
-d tradeData=[{\"coins\":\"dkkt_usdt\",\"number\":1,\"price\":0.6,\"type\":1},{\"coins\":\"dkkt_usdt\",\"number\":1,\"price\":0.7,\"type\":1}]\
"

Payload

{
    "status": 200,
    "msg": "",
    "time": 1579507028,
    "microtime": "0.16015400 1579507028",
    "source": "api",
    "data": [   // Return the information of each order in order
        {
            "orderId": 1036053514,  // order id
            "accountId": 70001018,  // UID
            "price": "8500.00",     // order price
            "amount": "1.00",       // order amount
            "numberOver": "1.00",   // unfilled amount
            "flag": "sale",         // type
            "status": 0,            // 0 not filled 1 partial filled 2 all filled
            "coinFrom": "btc",      // The currency to be exchanged 
            "coinTo": "usdt",       // Target exchange
            "fieldAmount": 0        // filled amount
        }
    ]
}

POST /V2/Trade/addEntrustSheetBatch

Parameters

Parameter Required Type Remarks
tradeData true string request json string,maximum 30 groups of data

tradeData description

Parameter Required Type Remarks
type true string type 1 buy 2 sell
price true float order price
number true float order amount
coins true string trading pair eth\btc,etc.

Description

One of the batch orders contains incorrect parameters, which will cause all failures

Response Content

Field Required Type Comment
orderId True int order id
accountId True int user id
price True string order price
amount True string order amount
numberOver True string unfilled amount
flag True string type
status True int 0 not filled 1 partial filled 2 all filled
coinFrom True string The currency to be exchanged
coinTo True string Target exchange
fieldAmount True float filled amount

Revocation of limit order

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/cancelEntrustSheet\
-X POST\
-d orderId=12345654321\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "updateAssetsData": {       // Assets change
      "coin": "bz",             // coin
      "over": "1000.00000000",  // available
      "lock": "-1000.00000000"  // frozen
    },
    "assetsInfo": {             // assets information
      "coin": "bz",
      "over": "999.00000000",
      "lock": "-999.00000000"
    }
  }
}

POST /V2/Trade/cancelEntrustSheet

Parameters

Parameter Required Type Remarks
orderId true string order id

Response Content

Field Required Type Comment
updateAssetsData True <Assets> Assets change
assetsInfo True <Assets> Assets information

Assets

Field Required Type Comment
coin True string coin
over True string available
lock True string frozen

Revocation of bunch limit orders

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/cancelAllEntrustSheet\
-X POST\
-d ids=1,2,3,4,5\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "744173808": {              // order ID
      "updateAssetsData": {       // assets change
        "coin": "bz",             // coin
        "over": "1000.00000000",  // available
        "lock": "-1000.00000000"  // frozen
      },
      "assetsInfo": {             // assets information
        "coin": "bz",
        "over": "999.00000000",
        "lock": "-999.00000000"
      }
    }
  }
}

POST /V2/Trade/cancelAllEntrustSheet

Parameters

Parameter Required Type Remarks
ids true string order ids 1,2,3,4 (separatedby comma)

Response Content

Field Required Type Comment
updateAssetsData True <Assets> Assets change
assetsInfo True <Assets> Assets information

Assets

Field Required Type Comment
coin True string coin
over True string available
lock True string frozen

Get a list of personal history orders

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/getUserHistoryEntrustSheet\
-X POST\
-d coinFrom=vtc\
&coinTo=dkkt\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "data": [   // order data list
      {
        "orderId":"693248739",   // order id
        "accountId":"2074056",
        "price":"100.00000000",   // order price
        "amount":"10.0000",       // order amount
        "fieldCashAmount":"0.00000000",   //total filled amount
        "numberOver":"0.0000",    // unfilled number
        "fieldAmount":"0.0000",   // filled amount
        "flag":"sale",            // type
        "status":3,               // 0 not filled 1 partial filled 2 all filled
        "isNew":"N",              // new order
        "coinFrom":"vtc",         // The currency to be exchanged
        "coinTo":"dkkt",          // Target exchange
        "tradeType" :"1",         // 1 limit price 2 market price
        "createdAt": "1533035300"
      }
    ],
    "pageInfo": {             // page information
      "limit": "10",          // number of records
      "offest": "0",          // initial position
      "current_page": 1,      // current page
      "page_size": 10,        // size of per page
      "total_count": 2,       // total number of records
      "page_count": 1         // total number of pages
    }
  }
}

POST /V2/Trade/getUserHistoryEntrustSheet

Parameters

Parameter Required Type Remarks
coinFrom false string eos、vtc coin
coinTo false string btc、eth trading range
type false integer 1:buy, 2:sell Return all when not transmitting
page false integer current page
size false integer Number of records per page max 100
startTime false string Start timestamp
endTime false string End timestamp

Response Content

data

Field Required Type Comment
orderId True string order id
price True string order price
amount True string order amount
fieldCashAmount True string total filled amount
numberOver True string unfilled number
fieldAmount True string filled amount
flag True string type
status True int 0 not filled 1 partial filled 2 all filled
isNew True string new order
coinFrom True string The currency to be exchanged
coinTo True string Target exchange
tradeType True string 1 limit price 2 market price

pageInfo

Field Required Type Comment
limit True int number of records
offest True int initial position
current_page True int current page
page_size True int size of per page
total_count True int total number of records
page_count True int total number of pages

Get personal current orders

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/getUserNowEntrustSheet\
-X POST\
-d coinFrom=vtc\
&coinTo=dkkt\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "data": [
      {
        "orderId": "693248739",  // order id
        "accountId": "2074056",
        "price":"100",   // order price
        "amount":"10",       // order amount
        "numberOver": "10",       // unfilled number
        "flag": "sale",           // type
        "status": "0",            // 0 not filled 1 partial filled 2 all filled
        "coinFrom": "vtc",        // The currency to be exchanged
        "coinTo": "dkkt",         // Target exchange
        "fieldAmount": "0",       // filled amount
        "isNew": "N",             // new order
        "tradeType": "1",         // 1 limit price 2 market price
        "createdAt": "1533035300",          // turnover timestamp
        "fieldCashAmount": "0.00000000"     // filled total amount
      }
    ],
    "pageInfo": {             // page information
      "limit": "10",          // number of records
      "offest": "0",          // initial position
      "current_page": 1,      // current page
      "page_size": 10,        // size of per page
      "total_count": 2,       // total number of records
      "page_count": 1         // total number of pages
    }
  }
}

POST /V2/Trade/getUserNowEntrustSheet

Parameters

Parameter Required Type Remarks
coinFrom false string eos、vtc coin
coinTo false string btc、eth trading range
type false integer 1:buy, 2:sell Return all when not transmitting
page false integer current page
size false integer Number of records per page max 100
startTime false string Start timestamp
endTime false string End timestamp

Response Content

data

Field Required Type Comment
orderId True string order id
price True string order price
amount True string order amount
numberOver True string unfilled number
flag True string type
status True int 0 not filled 1 partial filled 2 all filled
coinFrom True string The currency to be exchanged
coinTo True string Target exchange
fieldAmount True string filled amount
isNew True string new order
tradeType True string 1 limit price 2 market price
createdAt True string turnover timestamp
fieldCashAmount True string filled total amount

pageInfo

Field Required Type Comment
limit True int number of records
offest True int initial position
current_page True int current page
page_size True int size of per page
total_count True int total number of records
page_count True int total number of pages

Get order details

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/getEntrustSheetInfo\
-X POST\
-d orderId=123456\
"

Payload

{
    "status": 200,
    "msg": "",
    "time": 1579509364,
    "microtime": "0.46752700 1579509364",
    "source": "api",
    "data": {
        "orderId": "1036053514",      // order ID
        "accountId": "70001018",      // UID
        "price": "8500.0000000000",   // unit price
        "amount": "1.00000000",       // amount
        "fieldCashAmount": "8500.000000000000000000", // total amount
        "numberOver": "1.00000000",   // unfilled number
        "fieldAmount": "0.00000000",  // filled amount
        "flag": "sale",               // sale sign
        "status": 3,                  // 0 not filled 1 partial filled 2 all filled
        "coinFrom": "btc",            // The currency to be exchanged
        "coinTo": "usdt",             // Target exchange
        "averagePrice": "0",          // average price
        "orderTotalPrice": "0",       // Order transaction price
        "tradeType": "1",             // 1 limit price 2 market price
        "createdAt": "1579507025"     // turnover time
    }
}

POST /V2/Trade/getEntrustSheetInfo

Parameters

Parameter Required Type Remarks
orderId true string order id

Response Content

Field Required Type Comment
orderId True string order ID
accountId True string user ID
price True string unit price
amount True string amount
fieldCashAmount True string total amount
numberOver True string unfilled number
fieldAmount True string filled amount
flag True string sale sign
status True int 0 not filled 1 partial filled 2 all filled 3 canceled
coinFrom True string The currency to be exchanged
coinTo True string Target exchange
averagePrice True string average price
orderTotalPrice True string Order transaction price
tradeType True string 1 limit price 2 market price
createdAt True string turnover time

Get personal assets

example of CURL

curl "https://apiv2.bitz.com/V2/Assets/getUserAssets\
-X POST"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "cny": "0.00000000",        // CNY  estimated value
    "usd": "0.00000000",        // USD  estimated value
    "btc_total": "0.00000000",  // BTC  estimated value
    "list": [
      {
        "currency": "zpr",          // currency
        "balance": "37.49067275",   // balance
        "over": "37.49067275",      // available
        "lock": "0.00000000",       // frozen
        "btc": "0.00000000",        // btc  estimated value
        "usd": "0.00000000",        // usd  estimated value
        "cny": "0.00000000"         // cny  estimated value
      }
    ]
  }
}

POST /V2/Assets/getUserAssets

Response content

Field Required Type Comment
cny True string CNY estimated value
usd True string USD estimated value
btc_total True string BTC estimated value
list True array<asset> Assets list

asset

Field Required Type Comment
currency True string Coin name
balance True string balance
over True string available number
lock True string frozen number
btc True string BTC estimated value
usd True string USD estimated value
cny True string CNY estimated value

Get transactions list

example of CURL

curl "https://apiv2.bitz.com/V2/Trade/tradeList\
-X POST\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1575365142,
  "microtime": "0.26678700 1575365142",
  "source": "api",
  "data": {
    "data": [  // order data list
      {
        "orderId": "9092318640",    // order ID
        "price": "8000.00",         // target unit price
        "number": "0.10",           // order number
        "total": "800.0000",        // total transaction price
        "buyOrderId": "1035720873", // buyer order ID
        "buyUid": "6682685",        // buyer UID
        "saleOrderId": "1036051145",// seller order ID
        "saleUid": "70001018",      // seller UID
        "opt": "1",                 // operation type
        "coinFrom": "btc",            // The currency to be exchanged
        "coinTo": "usdt",             // Target exchange
        "createdAt": "1579506291",  // turnover time
        "flag": "sale",             // trading type,buy / sale
        "assetsType": "1",          // assets source
        "buyAssetsType": "2",
        "saleAssetsType": "1"
    }
    ],
    "pageInfo": {             // page information
      "limit": "10",          // number of records
      "offest": "0",          // initial position
      "current_page": 1,      // current page
      "page_size": 10,        // size of per page
      "total_count": 2,       // total number of records
      "page_count": 1         // total number of pages
    }
  }
}

POST /V2/Trade/tradeList

Response Content

data

Field Required Type Comment
orderId True string order ID
price True string target unit price
number True string order number
total True string total transaction price
buyOrderId True string buyer order ID
buyUid True string buyer UID
saleOrderId True string seller order ID
saleUid True string seller UID
opt True string operation type
coinFrom True string The currency to be exchanged
coinTo True string Target exchange
createdAt True string turnover time
flag True string trading type,buy / sale
assetsType True string assets source

pageInfo

Field Required Type Comment
limit True int number of records
offest True int initial position
current_page True int current page
page_size True int size of per page
total_count True int total number of records
page_count True int total number of pages

Contract Market

Get Market List of Contract Transactions

example of CURL

curl "https://apiv2.bitz.com/V2/Market/getContractCoin?\
contractId=123456\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": [
    {
      "contractId": "101",                // contract id
      "symbol": "BTC",                    // contract symbol
      "settleAnchor": "USDT",             // settle anchor
      "quoteAnchor": "USDT",              // quote anchor
      "contractAnchor": "BTC",            // contract anchor
      "contractValue": "0.00100000",      // single contract value
      "pair": "BTC_USDT",                 // contract market
      "expiry": "0000-00-00 00:00:00",    // contract expiry time (non-perpetual contract)
      "maxLeverage": "100",               // max leverage
      "maintanceMargin": "0.00500000",    // Maintain margin ratio
      "makerFee": "-0.00030000",          // maker fee
      "takerFee": "0.00070000",           // taker fee
      "settleFee": "0.00070000",          // settlement fee
      "priceDec": "1",                    // digits of price floating point
      "anchorDec": "2",                   // digits of quote anchor floating point
      "status": "1",                      // status,1: trading, 0:pending,-1:permanent stop
      "isreverse": "-1",                  // 1:reverse contract,-1: forward contract
      "allowCross": "1",                  // Allow cross position,1:Yes,-1:No
      "allowLeverages": "2",              // Leverage multiple allowed by the system

      "maxOrderNum": "50",                // max order number
      "maxAmount": "5000",                // max amount limit of single order
      "minAmount": "1",                   // min amount limit of single order
      "maxPositionAmount": "5000"         // max position amount
 }
  ]
}

GET /V2/Market/getContractCoin

Parameters

Parameter Required Type Comment
contractId False int Contract ID

Response Content

Field Required Type Comment
contractId True string contract id
symbol True string contract symbol
settleAnchor True string settle anchor
quoteAnchor True string quote anchor
contractAnchor True string contract anchor
contractValue True string single contract value
pair True string contract market
expiry True string contract expiry time (non-perpetual contract)
maxLeverage True string max leverage
maintanceMargin True string Maintain margin ratio
makerFee True string maker fee
takerFee True string taker fee
settleFee True string settlement fee
priceDec True string digits of price floating point
anchorDec True string digits of quote anchor floating point
status True string status,1: trading, 0:pending,-1:permanent stop
isreverse True string 1:reverse contract,-1: forward contract
allowCross True string Allow cross position,1:Yes,-1:No
allowLeverages True string Leverage multiple allowed by the system
maxOrderNum True string max order number
maxAmount True string max amount limit of single order
minAmount True string min amount limit of single order
maxPositionAmount True string max position amount

contract kline data

example of CURL

curl "https://apiv2.bitz.com/V2/Market/getContractKline?\
contractId=123456\
&type=5m\
&size=20\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "lists": [
      [
        "1558433100000",        // time
        "7921.69000000",        // opening price
        "7921.96000000",        // highest price
        "7882.31000000",        // lowest price
        "7882.31000000",        // closing price
        "1793940.00000000",     // volume
        "14183930623.27000000"  // turnover
      ]
    ]
  }
}

GET /V2/Market/getContractKline

Parameters

Parameter Required Type Comment
contractId True int Contract ID
type True string K-line type 1m, 5m, 15m, 30m, 1h, 4h, 1d
size False int Get data volume 1-300, default 300

Get the contract market depth

example of CURL

curl "https://apiv2.bitz.com/V2/Market/getContractOrderBook?\
contractId=123456\
&depth=10\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "bids": [
      {
        "price": "57.70000000",   // Best Bid price
        "amount": "2820"          // amount of best bid
      }
    ],
    "asks": [
      {
        "price": "8202.70000000", // Best ask price
        "amount": "4863"          // amount of best ask
      }
    ]
  }
}

GET /V2/Market/getContractOrderBook

Parameters

Parameter Required Type Comment
contractId True int Contract ID
depth False string Depth type 5, 10, 15, 20, 30, 100,,default10

Response Content

Field Required Type Comment
bids True array<item> Buying list
asks True array<item> Selling list

item

Field Required Type Comment
price True string Unit Price
amount True string Trading amount

Get Trade History of Certain Contract

example of CURL

curl "https://apiv2.bitz.com/V2/Market/getContractTradesHistory?\
contractId=123456\
&pageSize=10\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "lists": [
      {
        "time": 1558432920,   // timestamp 
        "price": "7926.41",   // price
        "num": 7137,          // contract number
        "type": "buy"         // type
      }
    ]
  }
}

GET /V2/Market/getContractTradesHistory

Parameters

Parameter Required Type Comment
contractId True int Contract ID
pageSize False int Get data volume 1-300, default 300

Response Content

Field Required Type Comment
time True string timestamp
price True string price
num True string contract number
type True string type

Get the latest market price of contract transactions

example of CURL

curl "https://apiv2.bitz.com/V2/Market/getContractTickers?\
contractId=123456\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": [
    {
      "contractId": "101",      // contract ID
      "pair": "BTC_USD",        // contract market
      "min": "7252.26",         // 24H lowest price
      "max": "8316.42",         // 24H highest price
      "latest": "8061.40",      // latest price
      "change24h": "0.1072",    // 24H change ratio
      "amount": "3445152.00",   // amount
      "volumn": "437.18",       // volume
      "openInterest": "810.00", // position amount
      "indexPrice": "8065.25",  // index price
      "fairPrice": "8060.09",   // fair price
      "nextFundingRate": "-0.00075000"  // predicted funding rate
    }
  ]
}

GET /V2/Market/getContractTickers

Parameters

Parameter Required Type Comment
contractId False int Contract ID

Response Content

Field Required Type Comment
contractId True string contract ID
pair True string contract market
min True string 24H lowest price
max True string 24H highest price
latest True string latest price
change24h True string 24H change ratio
amount True string amount
volumn True string volume
openInterest True string position amount
indexPrice True string index price
fairPrice True string fair price
nextFundingRate True string predicted funding rate

Futures Trading

Futures Trading order

example of CURL

curl "https://apiv2.bitz.com/V2/Contract/addContractTrade\
-X POST\
-d contractId=12345654321\
&amount=10\
&leverage=10\
&direction=1\
&type=market\
&isCross=1\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "orderId": 710370 // Transaction ID
  }
}

POST /V2/Contract/addContractTrade

Parameters

Parameter Required Type Comment
contractId true int contract ID
price false float Price, if the incoming type is market, there is no need to pass price
amount true int Contract Size
leverage true float Margin Multiple
direction true int Order Direction 1: long;-1: short
type true string Order Type limit: limit order; market: market order, String lowercase required
isCross true int Cross or not 1: cross,-1:fixed

Response Content

Field Required Type Comment
orderId True int Transaction ID

Futures Trading Order Cancellation

Request

example of CURL

curl "https://apiv2.bitz.com/V2/Contract/cancelContractTrade\
-X POST\
-d entrustSheetId=12345654321\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "orderId": 710370   // Cancelled order ID
  }
}

POST /V2/Contract/cancelContractTrade

Parameters

Parameter Required Type Commet
entrustSheetId true int Order ID

Response Content

Field Required Type Comment
orderId True int Transaction ID

Current Position

example of CURL

curl "https://apiv2.bitz.com/V2/Contract/getContractActivePositions\
-X POST\
-d contractId=12345654321\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "positionId": "9",
    "contractId": "101",
    "price": "7980.74",
    "direction": "1",
    "amount": "1500",
    "liquidationPrice": "7287.98",
    "rlzPnl": "0.00010170",
    "unrlzPnl": "0.00044862",
    "margin": "0.01930883",
    "leverage": "10.00000000",
    "isCross": "-1",
    "pair": "BTC_USD"
  }
}

POST /V2/Contract/getContractActivePositions

Parameters

Parameter Required Type Comment
contractId true int Contract ID

Response Content

Field Required Type Comment
positionId True string position ID
contractId True string contract ID
price True string open position average price
direction True string direction,1:long,-1:short
amount True string order amount
liquidationPrice True string price for force close
rlzPnl True string realized profits and losses
unrlzPnl True string unrealized profits and losses
margin True string position margin
leverage True string leverage
isCross True string is cross,1:Yes,-1:No
pair True string contract market

Get Contract Account Equity(Assets)

example of CURL

curl "https://apiv2.bitz.com/V2/Contract/getContractAccountInfo\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,     
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "time": 1557928650,             
    "estimate_BTC": "8.00667445",   // Total Equity(BTC)
    "estimate_USDT": "17000.00",    // Total Equity(USDT)
    "estimate_CNY": "0.00",         // Total Equity (CNY)
    "balances": [
      {
        "coin": "BTC",                    // coin
        "balance": "8.00000000",          // balance
        "positionMargin": "0.00635670",   // position margin
        "orderMargin": "0.00000000",      // order margin
        "unrlzPnl": "0.00031774",         // unrealized  profits and losses
        "total": "8.00667445",            // total valuation of the currency
        "estimate_BTC": "8.00667445",     // total valuation of the currency(BTC)
        "estimate_USDT": "0.00",          // total valuation of the currency(USDT)
        "estimate_CNY": "0.00"            // total valuation of the currency(CNY)
      }
    ]
  }
}

POST /V2/Contract/getContractAccountInfo

Response Content

Field Required Type Comment
estimate_BTC True string Total Equity(BTC)
estimate_USDT True string Total Equity(USDT)
estimate_CNY True string Total Equity (CNY)
balances True <balance> Detail of balance

balance

Field Required Type Comment
coin True string coin name
balance True string balance
positionMargin True string position margin
orderMargin True string order margin
unrlzPnl True string unrealized profits and losses
total True string total valuation of the currency
estimate_BTC True string total valuation of the currency(BTC)
estimate_USDT True string total valuation of the currency(USDT)
estimate_CNY True string total valuation of the currency(CNY)

Get the list of closed positions

example of CURL

curl "https://apiv2.bitz.com/V2/Contract/getContractMyPositions\
-X POST\
-d contractId=12345654321\
&page=1\
&pagesize=10\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "positionId": "9",        // position ID
    "contractId": "101",      // contract ID
    "rlzPnl": "0.00775756",   // realized profits and losses
    "startTime": 1557747092,  // start time
    "endTime": 1557783198,    // end time
    "pair": "BTC_USD"         // contract market
  }
}

POST /V2/Contract/getContractMyPositions

Parameters

Parameter Required Type Comment
contractId true int contract ID
page false int Default 1 Range 1-10
pageSize false int Default 50 Range 1-10

Response Content

Field Required Type Comment
positionId True string Position ID
contractId True string Contract ID
rlzPnl True string Realized profits and losses
startTime True int Trading start time
endTime True int Trading end time
pair True string Contract market

Get details of single or multiple orders

example of CURL

curl "https://apiv2.bitz.com/V2/Contract/getContractOrderResult\
-X POST\
-d entrustSheetIds=12345654321\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "orderId": "734709",  // order ID
    "contractId": "101",  // contract ID
    "pair": "BTC_USD",    // contract market
    "amount": "500",      // order amount
    "price": "7500.00",   // order price
    "type": "limit",      // type,limit: limit order,market: market order
    "leverage": "10",     // leverage
    "direction": "1",     // direction,1:long,-1:short
    "orderStatus": "-1",  // status,0:unfinished,1:finished,-1:cancelled
    "available": "500",   // available order
    "time": 1557994750    // time
  }
}

POST /V2/Contract/getContractOrderResult

Parameters

Parameter Required Type Comment
entrustSheetIds True string Order ID, up to 50, separated by commas, orderId in the return value

Response Content

Field Required Type Comment
orderId True string Order ID
contractId True string Contract ID
pair True string Contract market
amount True string Order amount
price True string Order price
type True string type,limit: limit order,market: market order
leverage True string leverage
direction True string direction,1:long,-1:short
orderStatus True string status,0:unfinished,1:finished,-1:cancelled
available True string available order
time True int time

Get Transaction Detail of Certain Order

example of CURL

curl "https://apiv2.bitz.com/V2/Contract/getContractTradeResult\
-X POST\
-d entrustSheetId=12345654321\
&page=1\
&pageSize=10\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "tradeId": "6534702673362395142", // Transaction ID
    "contractId": "101",              // Contract ID
    "pair": "BTC_USD",                // Contract Market
    "price": "8000.00",               // price
    "tradeNum": "500",                // amount
    "time": 1557994526,               // time
    "orderId": "732204",              // order ID
    "orderPrice": "8000.00",          // trade price
    "type": "buy",                    // type
    "tradeFee": "0.00001250",         // trading fee
    "leverage": "10",                 // leverage
    "isCross": "-1"                   // is cross,1:Yes,-1:No
  }
}

POST /V2/Contract/getContractTradeResult

Parameters

Parameter Required Type Comment
entrustSheetId True int Order ID In the return value
page False int Default 1 rang:1-10
pageSize False int Default50 rang:1-50

Response Content

Field Required Type Comment
tradeId True string Transaction ID
contractId True string Contract ID
pair True string Contract Market
price True string price
tradeNum True string amount
time True int time
orderId True string Order id
orderPrice True string Trade price
type True string Trade type
tradeFee True string trading fee
leverage True string leverage
isCross True string is cross,1:Yes,-1:No

Get My Active Order

example of CURL

curl "https://apiv2.bitz.com/V2/Contract/getContractOrder\
-X POST\
-d contractId=12345654321\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "orderId": "734709",  //order ID
    "contractId": "101",  //contract ID
    "amount": "500",      //amount
    "price": "7500.00",   //price
    "type": "limit",      //type,limit: limit order,market: market order
    "leverage": "10",     //leverage
    "direction": "1",     //direction,1:long,-1:short
    "orderStatus": "0",   //status,0:unfinished,1:finished,-1:cancelled
    "isCross": "-1",      //Is Cross,1:Yes,-1:No
    "available": "500",   //available order 
    "time": 1557994750,   //time
    "pair": "BTC_USD"     //contract market
  }
}

POST /V2/Contract/getContractOrder

Parameters

Parameter Required Type Comment
contractId True int Contract ID

Response Content

Field Required Type Comment
orderId True string order ID
contractId True string contract ID
amount True string amount
price True string price
type True string type,limit: limit order,market: market order
leverage True string leverage
direction True string direction,1:long,-1:short
orderStatus True string status,0:unfinished,1:finished,-1:cancelled
isCross True string Is Cross,1:Yes,-1:No
available True string available order
time True int time
pair True string contract market

Get My Order History

example of CURL

curl "https://apiv2.bitz.com/V2/Contract/getContractMyHistoryTrade\
-X POST\
-d contractId=12345654321\
"

Payload

{
  "status": 200,
  "msg": "",
  "time": 1573207257,
  "microtime": "0.25998300 1573207257",
  "source": "api",
  "data": {
    "orderId": "732204",    // Order ID
    "contractId": "101",    // contract ID
    "price": "8000.00",     // order price
    "amount": "500",        // amount
    "type": "limit",        // type,limit: limit order,market: market order
    "leverage": "10",       // leverage
    "direction": "1",       // direction,1:long,-1:short
    "orderStatus": "1",     // status,0:unfinished,1:finished,-1:cancelled
    "isCross": "-1",        // is cross,1:Yes,-1:No
    "available": "0",       // available order
    "time": 1557993999,     // time
    "pair": "BTC_USD"       // contract market

  }
}

POST /V2/Contract/getContractMyHistoryTrade

Parameters

Parameter Required Type Comment
contractId True int Order ID
page False int Default 1 rang:1-10
pageSize False int Default50 rang:1-50

Response Content

Field Required Type Comment
orderId True string Order Id
contractId True string Contract Id
price True string Price
amount True string Amount
type True string type,limit: limit order,market: market order
leverage True string Leverage
direction True string direction,1:long,-1:short
orderStatus True string status,0:unfinished,1:finished,-1:cancelled
isCross True string is cross,1:Yes,-1:No
available True string available order
time True int Time
pair True string Contract market

Get my trading history

example of CURL

curl "https://apiv2.bitz.com/V2/Contract/getContractMyTrades\
-X POST\
-d contractId=12345654321\
"

Payload

{
    "status": 200,
    "msg": "",
    "time": 1573207257,
    "microtime": "0.25998300 1573207257",
    "source": "api",
    "data": [
        {
            "tradeId": "6534702673362395142", //Transaction ID
            "contractId": "1",                //contract ID
            "pair": "BTC_USD",                //contract market
            "price": "8000.00",               //price
            "num": "500",                     //amount
            "type": "buy",                    //type
            "tradeFee": "0.00001250",         //trading fee
            "leverage": "10",                 //leverage
            "isCross": "-1",                  //is cross, 1:yes,-1:no
            "time": 1557994526                //dealing time
        }
    ]
}

POST /V2/Contract/getContractMyTrades

Parameters

Parameter Required Type Comment
contractId True int Order ID
page False int Default 1 rang:1-10
pageSize False int Default50 rang:1-50

Response Content

Field Required Type Comment
tradeId True string Transaction ID
contractId True string contract ID
pair True string contract market
price True string price
num True string amount
type True string type
tradeFee True string trading fee
leverage True string leverage
isCross True string is cross, 1:yes,-1:no
time True int dealing time

websockets Market

websocket URL

wss://wsapi.bitz.ai/

Data Format

In order to improve data transmission efficiency, BitZ The WebSocket API stopped returning uncompressed data at 17:00 (UTC+8) on October 08, 2019. All return data of Websocket Market APIs are compressed with GZIP so they need to be unzipped. BitZ API users should upgrade as soon as possible: add the dataType=1 parameter when subscribing, and decompress the data locally after receiving it.Please refer to documentation and demo for decompression demo

Heartbeat and Persistent Connection Strategy

  1. Client sends string ping every to server every 5 seconds, then Server returns pong to maintain persistent connection in this heartbeat.
  2. Server detects every 10 seconds: if haven't received ping from Client within 60 seconds, it will initiate to terminate the connection.
  3. Server detects network connection between Server and Client every 5 seconds, Server will delete this subscription if network is down, and Client won't receive new messages anymore, at this time Client needs to send re-subscription request, the previous subscription requests will be invalid.
  4. When Server sends new messages to Client, it will also detect the network connection status at this time, such as network interruption, and the Server will deal with it in the same way as mentioned above.

Send Request Command Format

Send json

{
    "action":"Topic.sub",
    "data":{
        "symbol":"bz_usdt",
        "type":"market,depth,order,kline",
        "resolution":"60min",
        "_CDID":"100002",
        "dataType":"1"
    },
    "msg_id":1562156656532
}

Command Details:

action :

data :

1. symbol
2. type
3. resolution (optional)
4. _CDID
5. dataType

msg_id :

market Market Overview

market market data:

{
    "msgId": 0,     // message id
    "params": [],   // parameter
    "data": {       // data
        "btc_usdt": {               // trading pair
            "s": "btc_usdt",        // trading pair
            "q": "748289393.19",    // 24h turnover
            "v": "68457.02",        // 24h trading volume
            "tp": "6.58",           // today's price change
            "p24": "11.74",         // 24h price change
            "o": "10138.95",        // Opening price
            "h": "11500.00",        // 24h maximum price
            "l": "9728.61",         // 24h minimum price
            "n": "11330.00",        // current price
            "nP": 4,                // digital place of volume
            "pP": 2,                // digital place of price
            "cny": "77978.74",      // RMB Valuation
            "usd": "11330.00",      // USD Valuation
            "krw": "13235981.30",   // KRW Valuation
            "jpy": "1220905.17"     // JPY Valuation
        },
        ...... // All other trading pair information
    },
    "action": "Pushdata.market",    // Subscribe type
    "time": 1562159048028,          // Message time
    "source": "sub-api"             // Message source
}

Push Content

Field Required Type Comment
s True string trading pair
q True string 24h turnover
v True string 24h trading volume
tp True string today's price change
p24 True string 24h price change
o True string Opening price
h True string 24h maximum price
l True string 24h minimum price
n True string current price
nP True int digital place of volume
pP True int digital place of price
cny True string RMB Valuation
usd True string USD Valuation
krw True string KRW Valuation
jpy True string JPY Valuation

order Order Information

order order information:

{
    "msgId": 0, // message id
    "params": { // parameter
        "symbol": "bz_usdt"     //trading pair
    },
    "action": "Pushdata.order", //Subscribe type
    "data": [   // data
        {
            "id": 1216814315,   // id
            "t": "21:04:10",    // time
            "T": 1562159050,    // timestamp
            "p": "0.1599",      // price
            "n": "2185.0000",   // quantity
            "s": "sell"         // direction sell; buy
        }
    ],
    "time": 1562159051901,      // Message time
    "source": "sub-api"         // Message source
}

Push Content

Field Required Type Comment
id True int id
t True string time
T True int timestamp
p True string price
n True string quantity
s True string direction sell; buy

depth Depth Information

depth depth information:

{
    "msgId": 0, // message id
    "params": { // parameter
        "symbol": "bz_usdt"     // trading pair
    },
    "action": "Pushdata.depth", // Subscribe type
    "data": {   // data
        "asks": [            // order direction: asks: sell, bids:buy
            [
                "0.1586",       // price
                "616.4175",     // quantity
                "97.7638"       // total amount
            ]
        ]
    },
    "time": 1562159910917,  // Message time
    "source": "sub-api"     // Message source
}

Push Content

Field Required Type Comment
asks True array Selling List : Price,Quantity,Amount
bids True array Buying List : Price,Quantity,Amount

kline K-Line Information

kline k-Line information:

{
    "msgId": 0, // message id
    "params": { // parameter
        "symbol": "bz_usdt",    // trading pair
        "resolution": "60min"   // k-line type
    },
    "action": "Pushdata.kline", // Subscribe type
    "data": {   // data
        "bars": [               // K-line chart
            {
                "time": "1562155200000",    // millisecond time stamp
                "open": "0.1609",           // Opening price
                "high": "0.1635",           // Maximum price
                "low": "0.1575",            // Minimum price
                "close": "0.1603",          // Closing price
                "volume": "1288739.3374",   // Trading volume
                "datetime": "2019-07-03 20:00:00" // K-line time stamp
            }
        ],
        "resolution": "60min",      // k-line type
        "symbol": "bz_usdt",        //  K-line trading pair
        "from": "1562155200000",    // start time
        "to": "1562151600000",      // end time
        "size": 1                   // total amount of K-line 
    },
    "time": 1562156715923,  // Message time
    "source": "sub-api"     // Message source
}

Push Content

Field Required Type Comment
bars True array<BarItem> K-line chart
resolution True string k-line type
symbol True string K-line trading pair
from True string start time
to True string end time
size True int total amount of K-line

BarItem

Field Required Type Comment
time True string millisecond timestamp
open True string Opening price
high True string Maximum price
low True string Minimum price
close True string Closing price
volume True string Trading volume
datetime True string K-line timestamp

Error

websocket order

Introduction

Access URL

Websocket order
wss://wsapi.bitz.ai/ws/v1

Heartbeat

{
    "timestamp": 1594030416,
    "action": "ping"
}

{
    "action": "pong",
    "timestamp": 1594030416
}

After connected to BitZ's Websocket server, the client need to send matching "ping" message periodically (currently at 20s interval) which contains an integer value as follows: When client receives this heartbeat message, it should response with a matching "pong" message which has the same integer in it, e.g.

Valid value of action

Valid Value Value Explanation
sub Subscribe
req Request
ping、pong Heartbeat
push Push (from BitZ server to client's server)

Rate Limit

Authentication

Authentication request::

{
    "ch": "auth",
    "params": {
        "accessKey": "040390e6935204a3c9c1ad0448e45356",
        "signatureMethod": "HmacSHA256",
        "signatureVersion": "1.0",
        "timestamp": "2020-07-06T04:21:11",
        "signature": "sx0y4SqYtW3Gy+Oq5lFyBi1Rjw+kFpJVDEyR/v+Cx+c="
    },
    "action": "req"
}

The response of success:

{
    "action": "req",
    "code": 200,
    "ch": "auth"
}

Authentication request field list

parameter required data type description
action true string Action type, valid value: "req"
ch true string Channel, valid value: "auth"
accessKey true string AccessKey
signatureMethod true string Signature method, valid value: "HmacSHA256"
signatureVersion true string Signature version, valid value:"1.0"
timestamp true string Timestamp in UTC in format like: 2020-07-06T19:01:55
signature true string Signature

Generating Signature

PHP Signature function example

function loginSign($apikey, $apiSec) {
    $d = new DateTime() ;
    $d->setTimezone(new DateTimeZone("UTC")) ;
    $t = $d->format("Y-m-d\TH:i:s");

    $params['accessKey'] = $apikey ;
    $params['signatureMethod'] = 'HmacSHA256' ;
    $params['signatureVersion'] = '1.0' ;
    $params['timestamp'] = $t ;

    ksort($params) ;

    $ss = "" ; 

    foreach ($params as $key => $value) {
        if (strlen($ss)>0) {
            $ss.="&" ;
        }

        $ss.="$key=$value" ;
    }

    $sig = hash_hmac('sha256', $ss, $apiSec, true);
    $sig = base64_encode($sig);


    $params['signature'] = $sig ;

    return $params ;
}
  1. The involved field names in signature generation are:accessKey,signatureMethod,signatureVersion,timestamp
  2. Signature method Reference Access Instructions/Signature Verification
  3. Unlike the API interface, data that participates in WS signing does not require url transcoding

Subscribe a Topic

Attention: The Subscribe depend on Authentication(Subscribe must after Authentication,otherwise -101 will be return)

{
    "ch": "orders#ethusdt",
    "action": "sub"
}

Upon success, Websocket client should receive a response below:

{
    "action": "sub",
    "code": 200,
    "ch": "orders#ethusdt"
}

Once the Websocket connection is established, Websocket client could send following request to subscribe a topic:

Request an Update

API Key permission: read

An Order update push can be triggered by any of the following events:
- Order Creation(eventType=creation)
- Order Matching(eventType=trade)
- Order Cancellation(eventType=cancellation)

The field list in order update message can be various per event type, developers can design the data structure in either of two ways: - Define a data structure including fields for all event types, allowing a few of them null - Define three data structure for each individual fields, inheriting from a common data structure which has common fields

Topic

orders#${symbol}

Subscription Parameter

Parameter Data Type Description
symbol string Trading Symbol(wildcard * is allowed )

Update Content

After order is in pending status –

{
    "action": "push",
    "ch": "orders#ethusdt",
    "data": {
        "eventType": "creation",
        "orderCreateTime": 1594091249,
        "orderId": 7532423537,
        "orderPrice": "208.60",
        "orderSize": "0.1000",
        "orderStatus": "submitted",
        "symbol": "ethusdt",
        "type": "buy-limit"
    }
}
Field Data Type Description
eventType string Event type, valid value:creation
symbol string Trading symbol
orderId long Order ID
orderPrice string Order Price
orderSize string Order size (inapplicable for market buy order)
orderValue string Order value (only applicable for market buy order)
type string Order type, valid value:buy-market, sell-market, buy-limit, sell-limit
orderStatus string Order status, valid value:submitted
orderCreateTime long Order creation time

After order matching –

{
    "action": "push",
    "ch": "orders#ethusdt",
    "data": {
        "tradePrice": "240.0000000000",
        "tradeVolume": "1.00000000",
        "tradeTime": 1599130028,
        "remainAmt": "0.000000",
        "orderId": 7557921347,
        "type": "buy-limit",
        "orderStatus": "filled",
        "symbol": "ethusdt",
        "eventType": "trade",
        "orderSize": "1.00000000",
        "filledSize": "1.00000000"
    }
}
Field Data Type Description
tradePrice string Trade Price
tradeVolume string Trade volume
tradeTime long Trade Time
remainAmt string Remaining amount (for buy-market order it's remaining value)
orderId long Order ID
type string Order type, valid value: buy-market, sell-market, buy-limit, sell-limit
orderStatus string Order status, valid value:partial-filled, filled
symbol string Trading Symbol
eventType string Event type, valid value: trade
orderSize string Order size (inapplicable for market buy order)
filledSize string Order filled size (inapplicable for market buy order)

Note: If a taker’s order matching with multiple orders at opposite side simultaneously, the multiple trades(tradePrice, tradeVolume, tradeTime) will be disseminated over separately instead of merging into one trade.

After order cancellation –

{
    "action": "push",
    "ch": "orders#ethusdt",
    "data": {
        "eventType": "cancellation",
        "filledSize": "0.00000000",
        "lastActTime": 1599464706,
        "orderId": 7558094765,
        "orderPrice": "240.0000000000",
        "orderSize": "1.00000000",
        "orderStatus": "canceled",
        "remainAmt": "1.00000000",
        "symbol": "ethusdt",
        "type": "buy-limit"
    }
}
Field Data Type Description
eventType string Event type, valid value: cancellation
lastActTime string Last activity time
orderId string Order ID
orderStatus string Order status, valid value: partial-canceled, canceled
remainAmt string Remaining amount (for buy-market order it's remaining value)
symbol string Trading symbol
type string Order type, valid value: buy-market, sell-market, buy-limit, sell-limit
orderValue string Order value (only applicable for market buy order)
orderSize string Order size (inapplicable for market buy order)
filledSize string Order filled size (inapplicable for market buy order)
orderPrice string Order Price (inapplicable for market order)

Error Code

The BitZ API uses the following error codes:

Error Code Description
200 Success
102 Invalid parameter
103 Authentification failed
104 Network Error-1
105 Invalid api signature
106 Network Error-2
107 Request path error
109 Invalid scretKey
110 The number of access requests exceeded
111 Current IP is not in the range of trusted IP
112 Service is under maintenance
114 The number of daily requests has reached the limit
117 The apikey expires
118 Expired Signature
119 Number of WebSocket connections is limited
100015 Trade password error
100044 Fail to request data
100101 Invalid symbol
100201 Invalid symbol
100301 Invalid symbol
100401 Invalid symbol
100302 Type of K-line error
100303 Size of K-line error
200000 Order has been revoked
200003 Please set trade password first
200005 This account can not trade
200025 Temporary trading halt
200027 Price Error
200028 Amount must be greater than 0
200029 Trading quantity must be between %s and %d
200030 Over price range
200031 Insufficient assets
200032 Please contact customer service
200033 Fail to trade
200034 Order has been completed or cancelled
200035 Cancellation error, order has been completed
200036 Cancellation error
200037 Trade direction error
200038 Trading pair error
200055 Order record does not exist
200056 Buy amount must be between %s and %d
300069 Illegal apiKey
300101 Transaction type error
300102 Price or quantity cannot be less than 0
300103 Trade password error
301001 Network Error-3
200053 Deposit suspended
300041 Withdrawal suspended
200001 The coin doesn't exist
200054 Temporarily unable to withdraw
300076 Your account is restricted from deposit
200004 Failed to create the address
300077 Your account is restricted from withdrawal
300046 Please bind your email first
300007 Please turn on phone verification or Google verification
200003 Please set the transaction password first
100015 Transaction password verification error
300040 Single Minimum withdrawal: %s. Single Maximum withdrawal: %d
300042 For security purposes, withdrawals are disabled for 24 hours after modifying security settings
300043 Please add withdrawal address first
100027 Insufficient assets
300044 Error in setting network fee
300048 Transfers between user accounts within the platform are not supported
300047 Please enter a valid withdrawal address
300049 Maximum MEMO length: 20 characters
300050 MEMO input is incorrect
300084 In order for withdrawal to be accurately arrived, you must enter the correct format of MEMO to some exchange addresses. If this is not the case, please check the format of the withdrawal address
300045 Your 24h withdrawal limit is %s BTC, and you are left with %d BTC limit
300075 Your withdrawal request needs approval. Please bind your phone number first
300091 Sorry, your API withdrawal amount exceeds the limit, please login to the BitZ APP or official website to withdraw
100031 Error in adding user’s assets
100028 Error in deducting assets
100031 Error in adding user’s assets
2001001 Internal error
2001003 Parameter incorrect
2001004 Signature incorrect
2001005 Contract does not exist
2001006 Trading suspended in this market
2001007 uid error
2001008 Contract trading not available
2001009 Price error
2001010 Contract account is locked
300092 The API withdrawal address is not added to the whitelist, and there is no historical withdrawal record
300037 Not in the withdrawal address list