English
javascript

USDT-based contract

This is the USDT-based contract api document.

1.Signature interface request method

Example

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.Current timestamp

let param = { // 2.Requested parameters
    "amount":"0.01",
    "symbol":"BTC",
    "type":0
};

let strParam = JSON.stringify(param); // 2.Formatting parameters

let strToSign = '' + timestamp + strParam; // 3.This is the string that needs to be signed

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.Signed result

let url = "https://api.bibox.com/v3/assets/transfer/cbc";

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//5.Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.Formatting parameters
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 7.response data

    });

Field name Field type Field description Field value
content-type string 'application/json'
bibox-api-key string your apikey
bibox-timestamp long Current timestamp,expressed in milliseconds timestamp
bibox-api-sign string Signature result sign

2.Fund transfer in

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.Current timestamp

let param = { // 2.Requested parameters
    "amount":"0.01",
};

let strParam = JSON.stringify(param); // 2.Formatting parameters

let strToSign = '' + timestamp + strParam; // 3.This is the string that needs to be signed

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.Signed result

let url = "https://api.bibox.com/v3.1/ctrade/transfer/in";

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//5.Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.Formatting parameters
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 7.response data

    });

POST https://api.bibox.com/v3.1/ctrade/transfer/in

Name Necessary or not Type Description Default Value Range
amount true integer USDT amount

Response

{
    "state":0, // success
    "result":"success",
}

Name Description
state 0 means success, otherwise means failure
Other fields ignore

3.Query assets

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/cquery/query/assets";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/cquery/query/assets

Response

{
    "result":{
        "balance":"97.2378", // Available Balance
        "freeze":"1.7326", // Frozen amount
        "profit":"-2.4327", 
        "margin":"1.7326",
        "imargin":"0.0000",
        "total_balance":"98.8397",
        "BTCValue":"0.02528321",
        "CNYValue":"664.61",
        "USDValue":"98.84",
        "floatProfitBTC":"-0.00003344",
        "floatProfit":"-0.1308",
        "profitBTC":"-0.00062226",
        "freezeBTC":"0.00044322"
    },
    "state":0,
}

Name Description
state 0 means success, otherwise means failure
balance Available Balance
freeze Frozen amount
Other fields ignore

4.Query single position information

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/cquery/query/order";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "pair":"4BTC_USDT"
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/cquery/query/order

Name Necessary or not Type Description Default Value Range
pair true string contract pair 4BTC_USDT,4ETH_USDT, ...

Response

{
    "result":{
        "coin_symbol":"USDT",
        "pair":"4BTC_USDT", // contract pair
        "contract":2, // Number of open positions
        "margin":"1.5612", // margin
        "profit":"-2.4995",
        "price":"3903.0450", // 开仓开仓均价均价
        "order_side":2, // Position opening direction: 1 open long, 2 open short
        "price_force":"3961.5907", // Liquidation price
        "floatProfit":"-0.1376",
        "leverage":50, // 0: Cross position, others: leverage of fixed position
        "icontract_up":2, // Number of open long and pending orders
        "icontract_down":0 // Number of open short and pending orders
    },
    "state":0, // success
}

Name Description
state 0 means success, otherwise means failure
pair contract pair
contract Number of open positions
margin margin
price Average open price
order_side Position opening direction: 1 open long, 2 open short
price_force Liquidation price
leverage 0: Cross position, others: leverage of fixed position
icontract_up Number of open long and pending orders
icontract_down Number of open short and pending orders
Other fields ignore

5.Query all position information

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/cquery/query/orderAll";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/cquery/query/orderAll

Response

{
    "result":[
        {
            "coin_symbol":"USDT",
            "pair":"4BTC_USDT", // contract pair
            "contract":2, // Number of open positions
            "margin":"1.5612", // margin
            "profit":"-2.4995",
            "price":"3903.0450", // Average open price
            "order_side":2, // Position opening direction: 1 open long, 2 open short
            "price_force":"3961.5907", // Liquidation price
            "floatProfit":"-0.1376",
            "leverage":50, // 0: Cross position, others: leverage of fixed position
            "icontract_up":2, // Number of open long and pending orders
            "icontract_down":0 // Number of open short and pending orders
        },
        ...
    ],
    "state":0,// success
}

Name Description
state 0 means success, otherwise means failure
pair contract pair
contract Number of open positions
margin margin
price Average open price
order_side Position opening direction: 1 open long, 2 open short
price_force Liquidation price
leverage 0: Cross position, others: leverage of fixed position
icontract_up Number of open long and pending orders
icontract_down Number of open short and pending orders
Other fields ignore

6.Query unfilled orders

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/cquery/query/orderPending";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "page":1,
    "size":20,
    "pair":""
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/cquery/query/orderPending

Name Necessary or not Type Description Default Value Range
page true integer page number 1,2, ...
size true integer return size 10,20, ...
pair false string contract pair 4BTC_USDT,4ETH_USDT, ...

Response

{
    "result":{
        "count":3,
        "page":1,
        "items":[
            {
                "id":491168, // order id
                "coin_symbol":"USDT",
                "pair":"4ETH_USDT", // contract pair
                "order_side":1, // Pending order direction: 1 open long, 2 open short
                "order_type":2,
                "contract":3, // order quantity
                "order_from":1,
                "status":1, // 0,1 not traded, 2 partly traded, 3 fully traded, 4 partly canceled, 5 completely canceled, 6,7 system canceled, >=100 order failed
                "price":"136.0000", // target price
                "price_deal":"0.0000", // deal price
                "deal_count":0, 
                "contract_deal":0, // quantity of contracts traded
                "createdAt":"2019-02-20T02:01:46.000Z",
                "updatedAt":"2019-02-20T02:01:46.000Z"
            },
            {
                "id":489453,
                "coin_symbol":"USDT",
                "pair":"4BTC_USDT",
                "order_side":1,
                "order_type":2,
                "contract":2,
                "order_from":1,
                "status":1,
                "price":"3850.0000",
                "price_deal":"0.0000",
                "deal_count":0,
                "contract_deal":0,
                "createdAt":"2019-02-20T01:51:41.000Z",
                "updatedAt":"2019-02-20T01:51:42.000Z"
            }
        ]
    },
    "state":0,// success
}

Name Description
state 0 means success, otherwise means failure
id order id
pair contract pair
order_side Pending order direction: 1 open long, 2 open short
contract order quantity
status 0,1 not traded, 2 partly traded, 3 fully traded, 4 partly canceled, 5 completely canceled, 6,7 system canceled, >=100 order failed
price target price
price_deal deal price
contract_deal quantity of contracts traded
Other fields ignore

6.1.Query deal orders last 10 days

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/cquery/query/getDealHistoryOrder";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "page":1,
    "size":20,
    "pair":"4BTC_USDT",
    "begin_time": new Date('2020-11-10T00:00:00.000Z').getTime(),
    "end_time": new Date('2020-11-11T00:00:00.000Z').getTime(),
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/cquery/query/getDealHistoryOrder

Name Necessary or not Type Description Default Value Range
page true integer page number 1,2, ...
size true integer return size 10,20, ...
pair false string contract pair 4BTC_USDT,4ETH_USDT, ...
begin_time false integer from timestamp last 10 days
end_time false integer to timestamp last 10 days

Response

{
    "result":{
        "count":3,
        "page":1,
        "items":[
            {
                "id":491168, // order id
                "coin_symbol":"USDT",
                "pair":"4ETH_USDT", // contract pair
                "order_side":1, // Pending order direction: 1 open long, 2 open short
                "order_type":2,
                "contract":3, // order quantity
                "order_from":1,
                "status":1, // 0,1 not traded, 2 partly traded, 3 fully traded, 4 partly canceled, 5 completely canceled, 6,7 system canceled, >=100 order failed
                "price":"136.0000", // target price
                "price_deal":"0.0000", // deal price
                "deal_count":0, 
                "contract_deal":0, // quantity of contracts traded
                "createdAt":"2019-02-20T02:01:46.000Z",
                "updatedAt":"2019-02-20T02:01:46.000Z"
            },
            {
                "id":489453,
                "coin_symbol":"USDT",
                "pair":"4BTC_USDT",
                "order_side":1,
                "order_type":2,
                "contract":2,
                "order_from":1,
                "status":1,
                "price":"3850.0000",
                "price_deal":"0.0000",
                "deal_count":0,
                "contract_deal":0,
                "createdAt":"2019-02-20T01:51:41.000Z",
                "updatedAt":"2019-02-20T01:51:42.000Z"
            }
        ]
    },
    "state":0,// success
}

Name Description
state 0 means success, otherwise means failure
id order id
pair contract pair
order_side Pending order direction: 1 open long, 2 open short
contract order quantity
status 0,1 not traded, 2 partly traded, 3 fully traded, 4 partly canceled, 5 completely canceled, 6,7 system canceled, >=100 order failed
price target price
price_deal deal price
contract_deal quantity of contracts traded
Other fields ignore

7.Place order

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/ctrade/order/open";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "pair":"4BTC_USDT",
    "order_type":2,
    "price":"3929.97",
    "contract":"1",
    "order_from":1,
    "leverage":50,
    "cross_leverage":25,
    "order_side":1,
    "client_oid": '123456789',
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/ctrade/order/open

Name Necessary or not Type Description Default Value Range
order_type true integer order type 1: market price, 2: limit price
leverage true integer leverage Cross:0,Fixed:1,2,...
cross_leverage false integer Cross position leverage 25 1,2,...50
order_side true integer order side 1: open long, 2: open short
price true string target price > 0
contract true string order quantiry 1,2, ...
pair true string contract pair 4BTC_USDT,4ETH_USDT, ...
order_from true integer 6 6
client_oid false Long client order id > 0

Response

{
    "result": '17592186044786', // order id
    "state":0, 
}

Name Description
state 0 means success, otherwise means failure
result order id
Other fields ignore

8.Batch place order

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/ctrade/order/openBatch";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "pair":"4ETH_USDT",
    "leverage":50,
    "cross_leverage": 25,
    "arr":[
        {
            "order_side":1,
            "price":140,
            "contract":1,
            "client_oid": '123456787' 
        },
        {
            "order_side":1,
            "price":140.5,
            "contract":1,
            "client_oid": '123456788' 
        }
    ]
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/ctrade/order/openBatch

Name Necessary or not Type Description Default Value Range
leverage true integer leverage Cross:0,Fixed:1,2,...
cross_leverage false integer Cross position leverage 25 1,2,...50
order_side true integer order side 1: open long, 2: open short
price true string target price > 0
contract true string order quantiry 1,2, ...
pair true string contract pair 4BTC_USDT,4ETH_USDT, ...
client_oid false Long client order id > 0

Response

{
    "result":[
        { 
            code: 0, // 0 means success, otherwise means failure
            id: '17592186044787', // order id
            msg: '',
            client_oid: '123456787' 
         },
         { 
            code: 0,
            id: '17592186044790',
            msg: '',
            client_oid: '123456788'
         }
    ],
    "state":0,
}

Name Description
state 0 means success, otherwise means failure
code 0 means success, otherwise means failure
id order id
Other fields ignore

9.Cancel order

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/ctrade/order/close";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "order_id":"574954"
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/ctrade/order/close

Name Necessary or not Type Description Default Value Range
order_id true string order id

Response

{
    "result":"success",
    "state":0,
}

Name Description
state 0 means success, otherwise means failure
Other fields ignore

10.Cancel multiple orders

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/ctrade/order/closeBatch";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "order_ids":[
        "574953",
        "574954"
    ]
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/ctrade/order/closeBatch

Name Necessary or not Type Description Default Value Range
order_ids true string Array of order id

Response

{
    "result":"success",
    "state":0,
}

Name Description
state 0 means success, otherwise means failure
Other fields ignore

11.Cancel 1000 orders

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/ctrade/order/closeAll";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/ctrade/order/closeAll

Response

{
    "result":"success",
    "state":0,
}

Name Description
state 0 means success, otherwise means failure
Other fields ignore

12.Cancel order through client_oid

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/ctrade/order/closeBatchClientOid";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "clientIds":[
        "1588819328619"
    ]
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/ctrade/order/closeBatchClientOid

Name Necessary or not Type Description Default Value Range
clientIds true string array Array of client_oid Limit 50 orders

Response

{
    "result":"success",
    "state":0,
}

Name Description
state 0 means success, otherwise means failure
Other fields ignore

13.Adjust leverage

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/ctrade/order/changeLeverage";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
     "pair":"4BTC_USDT",
     "leverage":40,
     "cross": 0
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/ctrade/order/changeLeverage

Name Necessary or not Type Description Default Value Range
pair true string contract pair 4BTC_USDT,4ETH_USDT, ...
leverage true integer leverage Cross:0,Fixed:1,2,...
cross true integer is it cross position 0 fixed position, 1 cross pofition

Response

{
    "result":"success",
    "state":0,
}

Name Description
state 0 means success, otherwise means failure
Other fields ignore

14.Adjust margin

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/ctrade/order/changeMargin";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "pair": "4ETH_USDT",
    "margin": 4
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/ctrade/order/changeMargin

Name Necessary or not Type Description Default Value Range
pair true string contract pair 4BTC_USDT,4ETH_USDT, ...
margin true integer margin The absolute value must be greater than or equal to 0.5

Response

{
    "result":"success",
    "state":0,
}

Name Description
state 0 means success, otherwise means failure
Other fields ignore

15.Query market deals

GET https://api.bibox.com/v3.1/cquery/deals?pair=4ETH_USDT&&size=10

Name Necessary or not Type Description Default Value Range
pair true String contract pair 4BTC_USDT,4ETH_USDT,...
size true integer return size 1,2,...

Response

{
    "result":[
        {
            "pair":"4ETH_USDT",      // contract pair
            "order_side":1,          // 1buy 2 sell
            "contract":75,           // quantity
            "price":"182.7500",      // deal price
            "createdAt":1565861520000 // time
        },
        ...
    ],
    "state": 0,
}

Name Description
state 0 means success, otherwise means failure
pair contract pair
order_side 1buy 2 sell
contract quantity
price deal price
createdAt time
Other fields ignore

16.Query order by order id

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/cquery/query/orderPendingByIDs";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "ids":[
        "491168",
        "2"
    ]
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/cquery/query/orderPendingByIDs

Name Necessary or not Type Description Default Value Range
ids true string array order id limit 50

Response

{
    "result":[
        {
            "id":491168, // order id
            "coin_symbol":"USDT",
            "pair":"4ETH_USDT", // contract pair
            "order_side":1, // Pending order direction: 1 open long, 2 open short
            "order_type":2,
            "contract":3, // order quantity
            "order_from":1,
            "status":1, // 0,1 not traded, 2 partly traded, 3 fully traded, 4 partly canceled, 5 completely canceled, 6,7 system canceled, >=100 order failed
            "price":"136.0000", // target price
            "price_deal":"0.0000", // deal price
            "deal_count":0, 
            "contract_deal":0, // quantity of contracts traded
            "createdAt":"2019-02-20T02:01:46.000Z",
            "updatedAt":"2019-02-20T02:01:46.000Z"
        },
        {
            "id":2,
            "coin_symbol":"USDT",
            "pair":"4BTC_USDT",
            "order_side":1,
            "order_type":2,
            "contract":1,
            "order_from":1,
            "status":3,
            "price":"3622.0000",
            "price_deal":"3622.0000",
            "deal_count":1,
            "contract_deal":1,
            "createdAt":"2019-02-15T13:10:27.000Z",
            "updatedAt":"2019-02-15T13:10:45.000Z"
        }
    ],
    "state":0
}

Name Description
state 0 means success, otherwise means failure
id order id
pair contract pair
order_side Pending order direction: 1 open long, 2 open short
contract order quantity
status 0,1 not traded, 2 partly traded, 3 fully traded, 4 partly canceled, 5 completely canceled, 6,7 system canceled, >=100 order failed
price target price
price_deal deal price
contract_deal quantity of contracts traded
Other fields ignore

17.Query pending order by client_oid

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/cquery/query/ordersDetailByClientIds";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "clientIds":[
        "1588819328619"
    ]
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/cquery/query/ordersDetailByClientIds

Name Necessary or not Type Description Default Value Range
clientIds true string array Array of client_oid limit 50

Response

{
    "result":[
        {
            "id": "71468256443234",
            "user_id": 101051,
            "client_oid": "1588819328619",
            "pair": "4BTC_USDT",
            "coin_symbol": "4BTC",
            "price": "9486.0000",
            "price_deal": "9485.9900",
            "contract": "15",
            "contract_deal": "4",
            "deal_count": "1",
            "order_side": 1,
            "order_type": 2,
            "order_from": 6,
            "status": 2,
            "reason": 0,
            "createdAt": 1588819336186,
            "updatedAt": 1588819336186
        },
    ],
    "state":0
}

Name Description
state 0 means success, otherwise means failure
id order id
pair contract pair
order_side Pending order direction: 1 open long, 2 open short
contract order quantity
status 0,1 not traded, 2 partly traded, 3 fully traded, 4 partly canceled, 5 completely canceled, 6,7 system canceled, >=100 order failed
price target price
price_deal deal price
contract_deal quantity of contracts traded
Other fields ignore

18.Query order by client_oid

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/cquery/query/orderPendingByClientIds";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "clientIds":[
        "1588819328619"
    ]
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/cquery/query/orderPendingByClientIds

Name Necessary or not Type Description Default Value Range
clientIds true string array Array of client_oid limit 50

Response

{
    "result":[
        {
            "id": 71468256443234,
            "client_oid": "1588819328619",
            "coin_symbol": "USDT",
            "pair": "4BTC_USDT",
            "order_side": 1,
            "order_type": 2,
            "contract": 15,
            "order_from": 6,
            "status": 3,
            "price": "9486.0000",
            "price_deal": "9485.9973",
            "deal_count": 2,
            "contract_deal": 15,
            "createdAt": "2020-05-07T02:42:16.000Z",
            "updatedAt": "2020-05-07T03:02:24.000Z"
        }
    ],
    "state":0
}

Name Description
state 0 means success, otherwise means failure
id order id
pair contract pair
order_side Pending order direction: 1 open long, 2 open short
contract order quantity
status 0,1 not traded, 2 partly traded, 3 fully traded, 4 partly canceled, 5 completely canceled, 6,7 system canceled, >=100 order failed
price target price
price_deal deal price
contract_deal quantity of contracts traded
Other fields ignore

19.Query position change records

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/cquery/query/orderList";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "pair":"4BTC_USDT",
    "page":1,
    "size":100,
    "begin_time":1550971541000,
    "end_time":1550977541000,
    "type": 2,
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

POST https://api.bibox.com/v3.1/cquery/query/orderList

Name Necessary or not Type Description Default Value Range
pair true String contract pair 4BTC_USDT,4ETH_USDT,...
page true integer page number 1,2,...
size true integer return size 1,2,...
begin_time false integer Starting time
end_time false integer End time
type false integer Record type 1 open position, 2 close position, 3 liquidate position, 4 lighten position

Response

{
    "result":{
        "count":101,
        "page":1,
        "items":[
            {
                "id":236343,
                "coin_symbol":"USDT", 
                "pair":"4BTC_USDT", // contract pair
                "type":2, // 1 open position, 2 close position, 3 liquidate position, 4 lighten position
                "order_side":2, // 1 open long, 2 open short
                "price_open":"3999.0000", // target price
                "price":"3964.5800", // Average open price
                "price_deal":"3999.0000", // deal price
                "contract":2, // order quantiry
                "profit":"0.6884", // profit
                "fee":"0.0000", // fee
                "createdAt":"2019-02-23T17:07:31.000Z"
            },
            ...
        ]
    },
    "state":0
}

Name Description
state 0 means success, otherwise means failure
pair contract pair
type 1 open position, 2 close position, 3 liquidate position, 4 lighten position
order_side 1 open long, 2 open short
price_open target price
price Average open price
price_deal deal price
contract order quantiry
profit profit
fee fee
Other fields ignore

20.Qeury trade details

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let url = "https://api.bibox.com/v3.1/cquery/query/orderDetailByID";

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret

let param = {
    "id":"58", // order id
};

let cmd = JSON.stringify(param); //format param
let timestamp = '' + (Date.now());
let sign = CryptoJS.HmacMD5(timestamp + cmd, secret).toString();//sign cmds

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: cmd//parameter string
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }

        console.log(body)

    });

GET https://api.bibox.com/v3.1/cquery/query/orderDetailByID

Name Necessary or not Type Description Default Value Range
id true String order id

Response

{
    "result":{
        "items":[
            {
                 "id":42,                  // record id
                "coin_symbol":"USDT",      //coin symbol
                "pair":"4BTC_USDT",        // contract pair
                "order_side":1,            // 1 open long, 2 open short
                "contract":1,              // order quantiry
                "order_from":1,            // 1 webpage, 2 Android,3ios, 6 apikey,
                "createdAt":"2019-08-13T08:22:25.000Z", // time
                "updatedAt":"2019-08-13T08:22:26.000Z", 
                "price":"7029.9700",       // target price
                "price_deal":"0.0000",     // deal price
                "fee":"0.0000",            // fee
                "is_cancel":1,             // 0 normal order; 1: cancelled
                "is_maker":1,              // 0: taker; 1: maker; 
                "order_type":2             // 1 market price; 2 limit price
            }
        ],
        "count":9,
        "page":1
    },
    "state":0
}

Name Description
state 0 means success, otherwise means failure
id record id
coin_symbol coin symbol
pair contract pair
order_side 1 open long, 2 open short
contract order quantiry
order_from 1 webpage, 2 Android,3ios, 6 apikey,
createdAt time
price target price
price_deal deal price
fee fee
is_cancel 0 normal order; 1: cancelled
is_maker 0: taker; 1: maker;
order_type 1 market price; 2 limit price
Other fields ignore

21.Query contract value

GET https://api.bibox.com/v3.1/cquery/contractValue

Response

{
    "result":[
        {
            "pair":"4BTC_USDT",  
            "value":"0.0100000000", 
            "coin_symbol":"BTC"
        },
       ...
    ],
    "state":0
}

Name Description
state 0 means success, otherwise means failure
pair pair
value value
Other fields ignore

22.Query contract config

GET https://api.bibox.com/v3.1/cquery/contractConfig

Response

{
    "result":{
        "cross_leverage":25,   // Cross position default leverage
        "leverage_max":50,    // Maximum leverage
        "margin_rate_force":"0.01", // Liquidation rate
        "night_fee_rate":"0.0006", 
        "hold_limit":{           // Maximum number of positions
            "BTC":5000,
            "ETH":150000,
            "EOS":50000,
            "LTC":35000,
            "BCH":100000
        }
    },
    "state":0
}

Name Description
state 0 means success, otherwise means failure
cross_leverage Cross position default leverage
leverage_max Maximum leverage
margin_rate_force Liquidation rate
hold_limit Maximum number of positions
Other fields ignore

23.Query single order quantity limit

GET https://api.bibox.com/v3.1/cquery/openLimit

Response

{
    "result":{
        "BTC":5000,
        "ETH":75000,
        "EOS":75000,
        "LTC":15000,
        "BCH":15000
    },
    "state":0
}

Name Description
state 0 means success, otherwise means failure
Other fields ignore

24.Query current fund rate

GET https://api.bibox.com/v3.1/cquery/lastPremiumIndex

Response

{
    "result":{
        "4BTC_USDT":{
            "id":164391,
            "pair":"4BTC_USDT", 
            "close":"0.0007000000",
            "fund_rate_up":"0.0005000000", 
            "fund_rate_down":"-0.0005000000",
            "createdAt":"2020-02-27T00:00:00.000Z",
            "updatedAt":"2020-02-27T00:00:00.000Z"
        },
        ...
    },
    "state":0
}

Name Description
state 0 means success, otherwise means failure
pair pair
fund_rate_up fund rate
Other fields ignore

25.Query k-line

Name Necessary or not Type Description Default Value Range
pair true string pair 4BTC_USDT, 4ETH_USDT, ...
period true string k-line period '1min', '3min', '5min', '15min', '30min', '1hour', '2hour', '4hour', '6hour', '12hour', 'day', 'week'
size false integer return size 1000 1-1000

Response

{
    "result":[
        {
            "time":1602680580000,// Timestamp
            "open":"10666.00000000",// Opening price
            "high":"10666.00000000",// Highest price
            "low":"10666.00000000", // Lowest price
            "close":"10666.00000000",// Closing price
            "vol":"0.00000000"// Volume
        },
        ...
    ],
    "cmd":"kline",
    "ver":"2.0"
}

Name Description
result Value means success, otherwise means failure
time Timestamp
open Opening price
high Highest price
low Lowest price
close Closing price
vol Volume
Other fields ignore

26.Query market depth

GET https://api.bibox.com/v2/mdata/depth?pair=4BTC_USDT&size=10

Name Necessary or not Type Description Default Value Range
pair true string pair 4BTC_USDT, 4ETH_USDT, ...
size false integer return size 200 1-200

Response

{
    "result":{
        "pair":"4BTC_USDT",
        "update_time":1602669350668,
        "asks":[//Seller Depth of Market

        ],
        "bids":[//Buyer market depth
            {
                "volume":"54054",//Order quantity
                "price":"10666"//Pending order price
            },
            ...
        ]
    },
    "cmd":"depth",
    "ver":"2.0"
}

Name Description
result Value means success, otherwise means failure
pair pair
update_time time
asks Seller Depth of Market
bids Buyer market depth
volume Order quantity
price Pending order price
Other fields ignore

27.Subscription to k-line

Example


const WebSocket = require('ws');
const zlib = require('zlib');

const biboxws = 'wss://push.bibox.me';

let wsClass = function () {

};

wsClass.prototype._decodeMsg = async function (data) {
    let that = this;
    return new Promise((resolve, reject) => {
        // console.log(Buffer.from(data, 'base64'))
        zlib.unzip(Buffer.from(data, 'base64'), (err, buffer) => {
            if (err) {
                return reject(err);
            }
            try {
                console.log('_decodeMsg', buffer.toString())
                let data = JSON.parse(buffer.toString());
                resolve(data);
            } catch (e) {
                console.log('_decodeMsg catch', buffer.toString())
                reject(e);
            }
        });
    }).catch(err => {
        console.warn(err);
    });
};

wsClass.prototype._consumerMsg = function (msg) {
    let that = this;
    Promise.resolve().then(async () => {
        let data = msg.data;
        if (msg.binary == 1) {
            data = await that._decodeMsg(data);
        }
    }).catch(err => {

    });
};

wsClass.prototype._initWs = async function () {
    let that = this;
    let ws = new WebSocket(biboxws);
    that.ws = ws;

    ws.on('open', function open() {
        console.log(new Date(), 'open')
        {
            ws.send(JSON.stringify({
                event: 'addChannel',
                channel: 'bibox_sub_spot_4BTC_USDT_kline_1min',
                binary: 0,
                ver: 8,
            }));
        }
    });

    ws.on('close', err => {
        console.log('close, ', err);
    });

    ws.on('error', err => {
        console.log('error', err);
    });

    ws.on('ping', err => {
        console.log('ping ', err.toString('utf8'));
    });

    ws.on('pong', err => {
        console.log('pong ', err.toString('utf8'));
    });

    ws.on('message', data => {
        console.log('message', data)
        let jdata = JSON.parse(data); // Response data
        for (let i = 0; i < jdata.length; i++) {
            let item = jdata[i];
            if (!item.data) {
                continue;
            }
            that._consumerMsg(item);
        }
    });
};

let instance = new wsClass();

instance._initWs().catch(err => {
    console.log(err);
});

wss://push.bibox.me

Name Necessary or not Type Description Default Value Range
pair true string pair 4BTC_USDT, 4ETH_USDT, ...
period true string k-line period 1min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 12hour, day, week
event true string event 'addChannel'
channel true string 'bibox_sub_spot_' + ${pair} + '_kline_' + ${period}
binary true int 0
ver true int 8

Response

[
    {
        "channel":"bibox_sub_spot_4BTC_USDT_kline_1min",
        "binary":0,
        "data_type":1,
        "data":[
            {
                "time":1603969980000,
                "open":"13131.80000000",
                "high":"13136.40000000",
                "low":"13131.80000000",
                "close":"13136.40000000",
                "vol":"43045.00000000"
            },
            {
                "time":1603970040000,
                "open":"13136.30000000",
                "high":"13136.80000000",
                "low":"13136.30000000",
                "close":"13136.70000000",
                "vol":"5561.00000000"
            }
        ]
    }
]

Name Description
time k-line start time
count Deal number
open Opening price
high Highest price
low Lowest price
close Closing price
vol Volume(Contract value)
binary 0 means the data is not compressed, 1 means the data is compressed
Other fields ignore

28.Subscription to market

Example


const WebSocket = require('ws');
const zlib = require('zlib');

const biboxws = 'wss://push.bibox.me';

let wsClass = function () {

};

wsClass.prototype._decodeMsg = async function (data) {
    let that = this;
    return new Promise((resolve, reject) => {
        // console.log(Buffer.from(data, 'base64'))
        zlib.unzip(Buffer.from(data, 'base64'), (err, buffer) => {
            if (err) {
                return reject(err);
            }
            try {
                console.log('_decodeMsg', buffer.toString())
                let data = JSON.parse(buffer.toString());
                resolve(data);
            } catch (e) {
                console.log('_decodeMsg catch', buffer.toString())
                reject(e);
            }
        });
    }).catch(err => {
        console.warn(err);
    });
};

wsClass.prototype._consumerMsg = function (msg) {
    let that = this;
    Promise.resolve().then(async () => {
        let data = msg.data;
        if (msg.binary == 1) {
            data = await that._decodeMsg(data);
        }
    }).catch(err => {

    });
};

wsClass.prototype._initWs = async function () {
    let that = this;
    let ws = new WebSocket(biboxws);
    that.ws = ws;

    ws.on('open', function open() {
        console.log(new Date(), 'open')
        {
            ws.send(JSON.stringify({
                event: 'addChannel',
                channel: 'bibox_sub_spot_ALL_ALL_market',
                binary: 0,
            }));
        }
    });

    ws.on('close', err => {
        console.log('close, ', err);
    });

    ws.on('error', err => {
        console.log('error', err);
    });

    ws.on('ping', err => {
        console.log('ping ', err.toString('utf8'));
    });

    ws.on('pong', err => {
        console.log('pong ', err.toString('utf8'));
    });

    ws.on('message', data => {
        console.log('message', data)
        let jdata = JSON.parse(data); // Response data
        for (let i = 0; i < jdata.length; i++) {
            let item = jdata[i];
            if (!item.data) {
                continue;
            }
            that._consumerMsg(item);
        }
    });
};

let instance = new wsClass();

instance._initWs().catch(err => {
    console.log(err);
});

wss://push.bibox.me

Name Necessary or not Type Description Default Value Range
event true string event 'addChannel'
channel true string 'bibox_sub_spot_ALL_ALL_market'
binary true int 0

Response

{
    "id":36,
    "is_hide":0,
    "pair_type":0,
    "area_id":15,
    "coin_symbol":"4BTC",
    "currency_symbol":"USDT",
    "last":"13669.5900",
    "high":"13860.2500",
    "low":"13626.4000",
    "change":"-90.6300",
    "percent":"-0.65%",
    "vol24H":"21492",
    "amount":"295494126.56",
    "last_cny":"90971.0974",
    "base_last_cny":"90971.09739152",
    "high_cny":"92239.9394",
    "low_cny":"90683.6680",
    "last_usd":"13669.5900",
    "high_usd":"13860.2500",
    "low_usd":"13626.4000",
    "time":0
}

Name Description
id pair id
coin_symbol coin symbol:4BTC、4ETH...
currency_symbol currency symbol
last last price
high 24h Highest price
low 24h Lowest price
change 24h change
percent 24h Quote change
vol24H 24h volume
amount 24h turnover(USDT)
last_cny last cny price
high_cny Highest cny price
low_cny Lowest cny price
last_usd last usd price
high_usd Highest usd price
low_usd Lowest usd price
binary 0 means the data is not compressed, 1 means the data is compressed
Other fields ignore

29.Subscription to Market depth

Example


const WebSocket = require('ws');
const zlib = require('zlib');

const biboxws = 'wss://push.bibox.me';

let wsClass = function () {

};

wsClass.prototype._decodeMsg = async function (data) {
    let that = this;
    return new Promise((resolve, reject) => {
        // console.log(Buffer.from(data, 'base64'))
        zlib.unzip(Buffer.from(data, 'base64'), (err, buffer) => {
            if (err) {
                return reject(err);
            }
            try {
                console.log('_decodeMsg', buffer.toString())
                let data = JSON.parse(buffer.toString());
                resolve(data);
            } catch (e) {
                console.log('_decodeMsg catch', buffer.toString())
                reject(e);
            }
        });
    }).catch(err => {
        console.warn(err);
    });
};

wsClass.prototype._consumerMsg = function (msg) {
    let that = this;
    Promise.resolve().then(async () => {
        let data = msg.data;
        if (msg.binary == 1) {
            data = await that._decodeMsg(data);
        }
    }).catch(err => {

    });
};

wsClass.prototype._initWs = async function () {
    let that = this;
    let ws = new WebSocket(biboxws);
    that.ws = ws;

    ws.on('open', function open() {
        console.log(new Date(), 'open')
        {
            ws.send(JSON.stringify({
                event: 'addChannel',
                channel: 'bibox_sub_spot_4BTC_USDT_depth', // depth
                binary: 0,
                ver: 3,
            }));
        }
    });

    ws.on('close', err => {
        console.log('close, ', err);
    });

    ws.on('error', err => {
        console.log('error', err);
    });

    ws.on('ping', err => {
        console.log('ping ', err.toString('utf8'));
    });

    ws.on('pong', err => {
        console.log('pong ', err.toString('utf8'));
    });

    ws.on('message', data => {
        console.log('message', data)
        let jdata = JSON.parse(data); // Response data
        for (let i = 0; i < jdata.length; i++) {
            let item = jdata[i];
            if (!item.data) {
                continue;
            }
            that._consumerMsg(item);
        }
    });
};

let instance = new wsClass();

instance._initWs().catch(err => {
    console.log(err);
});

wss://push.bibox.me

Name Necessary or not Type Description Default Value Range
pair true string pair 4BTC_USDT, 4ETH_USDT, ...
event true string event 'addChannel'
channel true string 'bibox_sub_spot_' + ${pair} + '_depth_'
binary true int 0
ver true int 3

Response

{
    "pair":"4BTC_USDT",
    "update_time":1604021669643,
    "seq":4544162,
    "add":{
        "asks":null,
        "bids":null
    },
    "del":{
        "asks":null,
        "bids":null
    },
    "mod":{
        "asks":[
            {
                "volume":"54000",
                "price":"13574.4"
            }
        ],
        "bids":[
            {
                "volume":"17012",
                "price":"13574.3"
            }
        ]
    }
}

Name Description
pair pair
last last price
last_cny last cny price
last_usd last usd price
high 24hHighest price
low 24hLowest price
buy Latest bid price
buy_amount Latest bid amount
sell Latest ask price
sell_amount Latest ask amount
vol 24hDeal amount
percent 24h Quote change
timestamp Timestamp
base_last_cny Latest cny price
binary 0 means the data is not compressed, 1 means the data is compressed
Other fields ignore

30.Subscription to deals detail

Example


const WebSocket = require('ws');
const zlib = require('zlib');

const biboxws = 'wss://push.bibox.me';

let wsClass = function () {

};

wsClass.prototype._decodeMsg = async function (data) {
    let that = this;
    return new Promise((resolve, reject) => {
        // console.log(Buffer.from(data, 'base64'))
        zlib.unzip(Buffer.from(data, 'base64'), (err, buffer) => {
            if (err) {
                return reject(err);
            }
            try {
                console.log('_decodeMsg', buffer.toString())
                let data = JSON.parse(buffer.toString());
                resolve(data);
            } catch (e) {
                console.log('_decodeMsg catch', buffer.toString())
                reject(e);
            }
        });
    }).catch(err => {
        console.warn(err);
    });
};

wsClass.prototype._consumerMsg = function (msg) {
    let that = this;
    Promise.resolve().then(async () => {
        let data = msg.data;
        if (msg.binary == 1) {
            data = await that._decodeMsg(data);
        }
    }).catch(err => {

    });
};

wsClass.prototype._initWs = async function () {
    let that = this;
    let ws = new WebSocket(biboxws);
    that.ws = ws;

    ws.on('open', function open() {
        console.log(new Date(), 'open')
        {
            ws.send(JSON.stringify({
                event: 'addChannel',
                channel: 'bibox_sub_spot_4BTC_USDT_deals', 
                binary: 0,
            }));
        }
    });

    ws.on('close', err => {
        console.log('close, ', err);
    });

    ws.on('error', err => {
        console.log('error', err);
    });

    ws.on('ping', err => {
        console.log('ping ', err.toString('utf8'));
    });

    ws.on('pong', err => {
        console.log('pong ', err.toString('utf8'));
    });

    ws.on('message', data => {
        console.log('message', data)
        let jdata = JSON.parse(data); // Response data
        for (let i = 0; i < jdata.length; i++) {
            let item = jdata[i];
            if (!item.data) {
                continue;
            }
            that._consumerMsg(item);
        }
    });
};

let instance = new wsClass();

instance._initWs().catch(err => {
    console.log(err);
});

wss://push.bibox.me

Name Necessary or not Type Description Default Value Range
pair true string pair 4BTC_USDT, 4ETH_USDT, ...
event true string event 'addChannel'
channel true string 'bibox_sub_spot_' + ${pair} + '_deals'
binary true int 0

Response

[
    {
        "pair":"4BTC_USDT",
        "price":"13570.600000",
        "amount":"800.00",
        "time":1604022129044,
        "side":2,
        "id":0
    }
]

Name Description
pair pair
price deal price
amount Deal amount
time Timestamp
side deal side, 1 buy, 2 sell
binary 0 means the data is not compressed, 1 means the data is compressed
Other fields ignore

31.Subscription to ticker

Example


const WebSocket = require('ws');
const zlib = require('zlib');

const biboxws = 'wss://push.bibox.me';

let wsClass = function () {

};

wsClass.prototype._decodeMsg = async function (data) {
    let that = this;
    return new Promise((resolve, reject) => {
        // console.log(Buffer.from(data, 'base64'))
        zlib.unzip(Buffer.from(data, 'base64'), (err, buffer) => {
            if (err) {
                return reject(err);
            }
            try {
                console.log('_decodeMsg', buffer.toString())
                let data = JSON.parse(buffer.toString());
                resolve(data);
            } catch (e) {
                console.log('_decodeMsg catch', buffer.toString())
                reject(e);
            }
        });
    }).catch(err => {
        console.warn(err);
    });
};

wsClass.prototype._consumerMsg = function (msg) {
    let that = this;
    Promise.resolve().then(async () => {
        let data = msg.data;
        if (msg.binary == 1) {
            data = await that._decodeMsg(data);
        }
    }).catch(err => {

    });
};

wsClass.prototype._initWs = async function () {
    let that = this;
    let ws = new WebSocket(biboxws);
    that.ws = ws;

    ws.on('open', function open() {
        console.log(new Date(), 'open')
        {
            ws.send(JSON.stringify({
                event: 'addChannel',
                channel: 'bibox_sub_spot_4BTC_USDT_ticker', 
                binary: 0,
            }));
        }
    });

    ws.on('close', err => {
        console.log('close, ', err);
    });

    ws.on('error', err => {
        console.log('error', err);
    });

    ws.on('ping', err => {
        console.log('ping ', err.toString('utf8'));
    });

    ws.on('pong', err => {
        console.log('pong ', err.toString('utf8'));
    });

    ws.on('message', data => {
        console.log('message', data)
        let jdata = JSON.parse(data); // Response data
        for (let i = 0; i < jdata.length; i++) {
            let item = jdata[i];
            if (!item.data) {
                continue;
            }
            that._consumerMsg(item);
        }
    });
};

let instance = new wsClass();

instance._initWs().catch(err => {
    console.log(err);
});

wss://push.bibox.me

Name Necessary or not Type Description Default Value Range
pair true string pair 4BTC_USDT, 4ETH_USDT, ...
event true string event 'addChannel'
channel true string 'bibox_sub_spot_' + ${pair} + '_ticker'
binary true int 0

Response

[
    {
        "channel":"bibox_sub_spot_4BTC_USDT_ticker",
        "binary":0,
        "data_type":1,
        "data":{
            "pair":"4BTC_USDT",
            "last":"13593.5",
            "last_usd":"13593.50",
            "last_cny":"91076.20",
            "high":"13700.300000",
            "low":"12986.000000",
            "buy":"13593.5",
            "buy_amount":"48375",
            "sell":"13593.6",
            "sell_amount":"56625",
            "vol":"155811681.00",
            "percent":"+2.44%",
            "timestamp":1604022393028,
            "base_last_cny":"91076.20000000"
        }
    }
]

Name Description
pair pair
last last price
last_cny last cny price
last_usd last usd price
high 24h Highest price
low 24h Lowest price
buy Latest bid price
buy_amount Latest bid amount
sell Latest ask price
sell_amount Latest ask amount
vol 24h Deal amount
percent 24h Quote change
timestamp Timestamp
base_last_cny Latest cny price
binary 0 means the data is not compressed, 1 means the data is compressed
Other fields ignore

32.Subscription to user data

Example


'use strict'

const WebSocket = require('ws');
let CryptoJS = require("crypto-js");

const biboxws = 'wss://push.bibox.me'; // 1.Request path

let apikey = '900625568558820892a8c833c33ebc8fd2701efe'; // your apikey
let param = {  // Define the parameter object param, need to use apikey
    "apikey": apikey,
    "channel": "bibox_sub_spot_ALL_ALL_login",
    "event": "addChannel"
};
let strParam = JSON.stringify(param); // Format the parameter object param, get strParam
let secret = 'c708ac3e70d115ec29efbee197330627d7edf842'; // apikey secret
let sign = CryptoJS.HmacMD5(strParam, secret).toString(); // Use apikey's secret to sign strParam with HmacMD5, and get the signature result sign
let wsparam = {  // 2.Request parameter
    "apikey": apikey,
    "channel": "bibox_sub_spot_ALL_ALL_login",
    "event": "addChannel",
    "sign": sign,
};


let init = function () {

    let ws = new WebSocket(biboxws);

    setInterval(function () {
        if (ws && ws.readyState == WebSocket.OPEN) {
            console.log('manu ping');
            ws.ping(Date.now());
        }
    }, 1000 * 10);

    ws.on('open', function open() {

        console.log('open')
        ws.send(JSON.stringify(wsparam));

    });

    ws.on('close', err => {
        console.log('close, ', err);
    });

    ws.on('error', err => {
        console.log('error', err);
    });

    ws.on('ping', err => {
        console.log('ping', err)
    });

    ws.on('pong', err => {
        console.log('pong', err)
    });

    ws.on('message', function incoming(data) {
        let jdata = JSON.parse(data); // response data
        if (!jdata.ping) {
            console.log('message', data)
        }

    });
};

module.exports = {};

init();


wss://push.bibox.me

Name Necessary or not Type Description Default Value Range
apikey true string your apikey
sign true string sign
event true string event 'addChannel'
channel true string 'bibox_sub_spot_ALL_ALL_login'

1.Define the parameter object param, need to use apikey

let apikey = 'thisisyourapikey';

let param = { "apikey": apikey, "channel": "bibox_sub_spot_ALL_ALL_login", "event": "addChannel" };

2.Format the parameter object param, get strParam

let strParam = JSON.stringify(param);

3.Use apikey's secret to sign strParam with HmacMD5, and get the signature result sign

let CryptoJS = require("crypto-js");

let secret = 'c708ac3e70d115ec29efbee197330627d7edf842';

let sign = CryptoJS.HmacMD5(strParam, secret).toString();

4.Generate subscription parameters wsparam

let wsparam = { "apikey": apikey, "channel": "bibox_sub_spot_ALL_ALL_login", "event": "addChannel", "sign": sign, };

Response

[
    {
        "channel":"bibox_sub_spot_ALL_ALL_login",
        "binary":"0",
        "data_type":0,
        "data":{
            "result":"订阅成功"
        }
    }
]

Name Description
result "订阅成功" means subscription success
Other fields ignore

33.Get assets from subscribed user data

contract_assets

Response

[
    {
        "channel":"bibox_sub_spot_ALL_ALL_login",
        "binary":"0",
        "data_type":1,
        "data":{
            "contract_assets":{
                "user_id":10101010,
                "coin_symbol":"USDT",
                "balance":"99.1823", // Available Balance
                "freeze":"0.7899", // Frozen amount
                "profit":"-3.6816",
                "margin":"0.7899", // margin
                "imargin":"0.0000" // Order frozen funds
            }
        }
    }
]

Name Description
balance Available Balance
freeze Frozen amount
margin margin
imargin Order frozen funds
Other fields ignore

33.Get position from subscribed user data

contract_order

Response

[
    {
        "channel":"bibox_sub_spot_ALL_ALL_login",
        "binary":"0",
        "data_type":1,
        "data":{
            "contract_order":{
                "user_id":10101010,
                "coin_symbol":"USDT",
                "pair":"4BTC_USDT", // contract pair
                "order_side":2, // position side,1 open long, 2 open short
                "price":"3949.7850", // Average open price
                "price_up":"4009.0200", // Average price of pending open long orders
                "price_down":"3946.0300", // Average price of pending open short orders
                "fee_rate":"0.0000",
                "contract":2, // Number of open positions
                "margin":"1.5799", // margin
                "imargin":"0.0000", // Orders frozen funds
                "icontract_up":1, // The number of pending order open long
                "icontract_down":0, // The number of pending order open short
                "leverage":"50", // leverage,0 means cross position
                "price_force":"4009.0318", // Liquidation price
                "price_alert":"3989.2829", // Alert price
                "profit":"-3.5492" 
            }
        }
    }
]

Name Description
pair contract pair
order_side position side,1 open long, 2 open short
price Average open price
price_up Average price of pending open long orders
price_down Average price of pending open short orders
contract Number of open positions
margin margin
imargin Orders frozen funds
icontract_up The number of pending order open long
icontract_down The number of pending order open short
leverage leverage,0 means cross position
price_force Liquidation price
price_alert Alert price
Other fields ignore

35.Get order from subscribed user data

contract_pending

Response

[
    {
        "channel":"bibox_sub_spot_ALL_ALL_login",
        "binary":"0",
        "data_type":1,
        "data":{
            "contract_pending":{
                "id":"628754", // order id
                "user_id":10101010,
                "client_oid": "1589868279533",
                "coin_symbol":"USDT",
                "pair":"4BTC_USDT", // contract pair
                "order_side":1, // 1 open long, 2 open short
                "order_type":1,
                "price":"4009.0200", // target price
                "contract":1, // order quantity
                "order_from":1,
                "status":3, // 0,1 not traded, 2 partly traded, 3 fully traded, 4 partly canceled, 5 completely canceled, 6,7 system canceled, >=100 order failed
                "price_deal":"3952.5600", // deal price
                "contract_deal":1, // deal quantity
                "deal_count":1,
                "createdAt":1550671734000, // time
                "updatedAt":1550671734000
            }
        }
    }
]

Name Description
id order id
pair contract pair
order_side 1 open long, 2 open short
price target price
contract order quantity
status 0,1 not traded, 2 partly traded, 3 fully traded, 4 partly canceled, 5 completely canceled, 6,7 system canceled, >=100 order failed
price_deal deal price
contract_deal deal quantity
createdAt time
Other fields ignore

36.Get deals detail from subscribed user data

contract_detail

Response

[
    {
        "channel":"bibox_sub_spot_ALL_ALL_login",
        "binary":"0",
        "data_type":1,
        "data":{
            "contract_detail":{
                "order_id":"628754", // order id
                "user_id":10101010,
                "coin_symbol":"USDT",
                "pair":"4BTC_USDT", // contract pair
                "order_side":1, // 1 open long, 2 open short
                "order_type":1, // 1 market price, 2 limit price
                "order_from":1,
                "contract":1, // deal quantity
                "price":"4009.0200", // target price
                "price_deal":"3952.5600", // deal price
                "fee":"0.0000", // fee
                "is_maker":0, // is maker
                "is_cancel":0, // is cancel order
                "is_persist":0,
                "force_sub":0,
                "createdAt":1550671735000, // time
                "updatedAt":1550671735000
            }
        }
    }
]

Name Description
order_id order id
pair contract pair
order_side 1 open long, 2 open short
order_type 1 market price, 2 limit price
contract deal quantity
price target price
price_deal deal price
fee fee
is_maker is maker
is_cancel is cancel order
createdAt time
Other fields ignore

37.Get changes in positions from subscribed user data

contract_deal_log

Response

{
    "channel":"bibox_sub_spot_ALL_ALL_login",
    "binary":"0",
    "data_type":1,
    "data":{
        "contract_deal_log":{
            "id":"1125899906842966183", 
            "user_id":10040000,
            "type":"1", // 1 open a position, 2 close a position, 3 close a position, 4 lighten a position
            "pair":"4ETH_USDT",
            "coin_symbol":"USDT",
            "price_open":"182.2091272149", // Average open price
            "price":"181.1900", // target price
            "price_deal":"181.1900", // deal price
            "contract":"1", // deal quantity,May be negative
            "profit":"0", // profit
            "fee":"0.0011", // fee
            "order_side":1, // order side
            "createdAt":1572855008209,
            "updatedAt":1572855008209
        }
    }
}

Name Description
type 1 open a position, 2 close a position, 3 close a position, 4 lighten a position
price_open Average open price
price target price
price_deal deal price
contract deal quantity,May be negative
profit profit
fee fee
order_side order side,1 open long, 2 open short
Other fields ignore

38.Subscription to index price

Example


const WebSocket = require('ws');
const zlib = require('zlib');

const biboxws = 'wss://push.bibox.me';

let wsClass = function () {

};

wsClass.prototype._decodeMsg = async function (data) {
    let that = this;
    return new Promise((resolve, reject) => {
        // console.log(Buffer.from(data, 'base64'))
        zlib.unzip(Buffer.from(data, 'base64'), (err, buffer) => {
            if (err) {
                return reject(err);
            }
            try {
                console.log('_decodeMsg', buffer.toString())
                let data = JSON.parse(buffer.toString());
                resolve(data);
            } catch (e) {
                console.log('_decodeMsg catch', buffer.toString())
                reject(e);
            }
        });
    }).catch(err => {
        console.warn(err);
    });
};

wsClass.prototype._consumerMsg = function (msg) {
    let that = this;
    Promise.resolve().then(async () => {
        let data = msg.data;
        if (msg.binary == 1) {
            data = await that._decodeMsg(data);
        }
    }).catch(err => {

    });
};

wsClass.prototype._initWs = async function () {
    let that = this;
    let ws = new WebSocket(biboxws);
    that.ws = ws;

    ws.on('open', function open() {
        console.log(new Date(), 'open')
        {
            ws.send(JSON.stringify({
                event: 'addChannel',
                channel: 'bibox_sub_spot_ALL_ALL_indexMarket',
                binary: 1,
            }));
        }
    });

    ws.on('close', err => {
        console.log('close, ', err);
    });

    ws.on('error', err => {
        console.log('error', err);
    });

    ws.on('ping', err => {
        console.log('ping ', err.toString('utf8'));
    });

    ws.on('pong', err => {
        console.log('pong ', err.toString('utf8'));
    });

    ws.on('message', data => {
        console.log('message', data)
        let jdata = JSON.parse(data); // Response data
        for (let i = 0; i < jdata.length; i++) {
            let item = jdata[i];
            if (!item.data) {
                continue;
            }
            that._consumerMsg(item);
        }
    });
};

let instance = new wsClass();

instance._initWs().catch(err => {
    console.log(err);
});

wss://push.bibox.me

Name Necessary or not Type Description Default Value Range
event true string event 'addChannel'
channel true string 'bibox_sub_spot_ALL_ALL_indexMarket'
binary true int 1

Response

[
    {
        "id":146,
        "is_hide":0,
        "pair_type":0,
        "area_id":15,
        "coin_symbol":"BTC",
        "currency_symbol":"USDT",
        "last":"3955.1652",
        "high":"3993.1069",
        "low":"3880.6072",
        "change":"+6.1701",
        "percent":"+0.16%",
        "vol24H":"43109",
        "amount":"169654088.16",
        "last_cny":"26588.2733",
        "base_last_cny":"",
        "high_cny":"26843.3333",
        "low_cny":"26087.0635",
        "last_usd":"3955.1651",
        "high_usd":"3993.1068",
        "low_usd":"3880.6072"
    },
    ...
]

Name Description
coin_symbol coin symbol
currency_symbol currency symbol
last last price
last_cny last cny price
last_usd last usd price
high 24h Highest price
low 24h Lowest price
buy last bid price
buy_amount last bid amount
sell last ask price
sell_amount last ask amount)
percent 24h Quote change
timestamp timestamp
binary 0 means the data is not compressed, 1 means the data is compressed
Other fields ignore

39.Subscription to price limit

Example


const WebSocket = require('ws');
const zlib = require('zlib');

const biboxws = 'wss://push.bibox.me';

let wsClass = function () {

};

wsClass.prototype._decodeMsg = async function (data) {
    let that = this;
    return new Promise((resolve, reject) => {
        // console.log(Buffer.from(data, 'base64'))
        zlib.unzip(Buffer.from(data, 'base64'), (err, buffer) => {
            if (err) {
                return reject(err);
            }
            try {
                console.log('_decodeMsg', buffer.toString())
                let data = JSON.parse(buffer.toString());
                resolve(data);
            } catch (e) {
                console.log('_decodeMsg catch', buffer.toString())
                reject(e);
            }
        });
    }).catch(err => {
        console.warn(err);
    });
};

wsClass.prototype._consumerMsg = function (msg) {
    let that = this;
    Promise.resolve().then(async () => {
        let data = msg.data;
        if (msg.binary == 1) {
            data = await that._decodeMsg(data);
        }
    }).catch(err => {

    });
};

wsClass.prototype._initWs = async function () {
    let that = this;
    let ws = new WebSocket(biboxws);
    that.ws = ws;

    ws.on('open', function open() {
        console.log(new Date(), 'open')
        {
            ws.send(JSON.stringify({
                event: 'addChannel',
                channel: 'bibox_sub_spot_ALL_ALL_contractPriceLimit',
                binary: 1,
            }));
        }
    });

    ws.on('close', err => {
        console.log('close, ', err);
    });

    ws.on('error', err => {
        console.log('error', err);
    });

    ws.on('ping', err => {
        console.log('ping ', err.toString('utf8'));
    });

    ws.on('pong', err => {
        console.log('pong ', err.toString('utf8'));
    });

    ws.on('message', data => {
        console.log('message', data)
        let jdata = JSON.parse(data); // Response data
        for (let i = 0; i < jdata.length; i++) {
            let item = jdata[i];
            if (!item.data) {
                continue;
            }
            that._consumerMsg(item);
        }
    });
};

let instance = new wsClass();

instance._initWs().catch(err => {
    console.log(err);
});

wss://push.bibox.me

Name Necessary or not Type Description Default Value Range
event true string event 'addChannel'
channel true string 'bibox_sub_spot_ALL_ALL_contractPriceLimit'
binary true int 1

Response

{
    "4BTC_USDT":{
        "min_up":"2964.4562",
        "max_up":"4090.9496",
        "min_down":"3814.2670",
        "max_down":"4940.7603",
        "market_up":"4090.9496",
        "market_down":"3814.2670"
    },
    "4ETH_USDT":{
        "min_up":"110.3038",
        "max_up":"155.1606",
        "min_down":"138.9828",
        "max_down":"183.8396",
        "market_up":"155.1606",
        "market_down":"138.9828"
    }
}

Name Description
min_up Open long minimum price
max_up Open long maximum price
min_down Open short minimum price
max_down Open short maximum price
market_up Open long maximum market price
market_down Open short minimum market price
binary 0 means the data is not compressed, 1 means the data is compressed
Other fields ignore

40.Fund transfer out

Request

let CryptoJS = require("crypto-js");
let request = require("request");

let timestamp = Date.now(); // 1.Current timestamp

let param = { // 2.Requested parameters
    "amount":"0.01",
};

let strParam = JSON.stringify(param); // 2.Formatting parameters

let strToSign = '' + timestamp + strParam; // 3.This is the string that needs to be signed

let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.Signed result

let url = "https://api.bibox.com/v3.1/ctrade/transfer/out";

request.post({
        url: url,//Request path
        method: "POST",//Request method
        headers: {//5.Set request headers
            'content-type': 'application/json',
            'bibox-api-key': apikey,
            'bibox-api-sign': sign,
            'bibox-timestamp': timestamp
        },
        body: strParam // 6.Formatting parameters
    },

    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error('upload failed:', err);
        }
        console.log(body) // 7.response data

    });

POST https://api.bibox.com/v3.1/ctrade/transfer/out

Name Necessary or not Type Description Default Value Range
amount true integer USDT amount

Response

{
    "state":0, // success
    "result":"success",
}

Name Description
state 0 means success, otherwise means failure
Other fields ignore

Errors

错误码

Code 描述 Msg
2003 Cookie 失效 Cookie expired
2033 操作失败!订单已完成或已撤销 Operation failed! Order completed or canceled
2034 操作失败!请检查参数是否正确 Operation failed! Please check parameter
2040 操作失败!没有该订单 Operation failed! No record
2064 订单撤销中,不能再次撤销 Canceling. Unable to cancel again
2065 委托价格设置过高,请重新设置价格 Precatory price is exorbitant, please reset
2066 委托价格设置过低,请重新设置价格 Precatory price is low , please reset
2067 暂不支持市价单 Limit Order Only
2068 下单数量不能低于0.0001 Min Amount:0.0001
2069 市价单无法撤销 Market order can not be canceled
2078 下单价格非法 unvalid order price
2085 币种最小下单数量限制 the trade amount is low
2086 账户资产异常,限制下单 Abnormal account assets, trade is forbiden
2091 请求过于频繁,请稍后再试 request is too frequency, please try again later
2092 币种最小下单金额限制 Minimum amount not met
3000 请求参数错误 Requested parameter incorrect
3002 参数不能为空 Parameter cannot be null
3009 推送订阅channel不合法 Illegal subscription channel
3010 websocket连接异常 websocket connection error
3011 接口不支持apikey请求方式 Illegal subscribe event
3012 apikey无效 Interface does not support apikey request method
3016 交易对错误 Invalid apikey
3017 推送订阅event不合法 Trading pair error
3024 apikey权限不足 apikey authorization insufficient
3025 apikey签名验证失败 apikey signature verification failed
3026 apikey ip受限制 apikey ip is restricted
3027 账户没有apikey No apikey in your account
3028 账户apikey数量超过了限制数量 Account apikey has exceeded the limit amount
3029 apikey允许ip数量超过了限制数量 apikey ip has exceeded the limit amount
3033 查询类请求限制一个cmd query allow only one cmd
3034 最大cmd个数限制 maxinum cmds
3035 cmd请求个数限制 too many cmds
4000 当前网络连接不稳定,请稍候重试 the network is unstable now, please try again later
4003 服务器繁忙,请稍后再试 The server is busy, please try again later