Base-USDT contract
List of alternate API domains
https://api.bibox.tel/v1/public/queryApiDomain
SDK and Demo
console.log('Base-USDT contract javascript Demo');
Bibox provides contract SDKs for developers in multiple languages.
These SDKs are developed based on the Bibox contract API and automatically complete the following functions:
- Data signature
- Data merge, for example: automatically merge depth
It's more convenient to use SDK to develop programs to access Bibox than to use API.
If you need to download or read more information, please click the following link:
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":"USDT",
"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/cbuassets/transfer";
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
});
1.Get current timestamp
2.Understand the parameter param required by the interface request, and format the parameter to get strParam
3.Generate the string strToSign that needs to be signed
4.Use apikey's secret to sign the string strToSign that needs to be signed with HmacMD5
5.When requesting, set the following fields of http headers
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 |
6.When requesting, set http body as the formatted request parameter strParam
7.The return value contains the field state, 0 means success, and other error codes, means failure. Successful results will have a corresponding field result, and failed results will have a corresponding field msg.
2.Fund transfer
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",
"symbol":"USDT",
"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"; //你的 apikey 密码
let sign = CryptoJS.HmacMD5(strToSign, secret).toString();//4.Signed result
let url = "https://api.bibox.com/v3/cbuassets/transfer";
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
});
- 1.Request path
POST https://api.bibox.com/v3/cbuassets/transfer
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
amount | true | string | Number to string | ||
symbol | true | string | coin symbol | USDT | |
type | true | integer | 0 transfer in, 1 transfer out | 0,1 |
Response
{
"state":0, // success
"result":"352559634189422592" // ignore
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
Other fields | ignore |
3.Place order
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/open";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"pair":"4BTC_USDT",
"order_side":1,
"order_type":2,
"price":"11500",
"amount":1,
"order_from":6,
"client_oid": "1234567890",
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/open
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
amount | true | string | Number to string (Must be a multiple of the contract unit) | ||
order_side | true | integer | Order side, 1 open long, 2 open short, 3 close long, 4 close short | 1,2,3,4 | |
order_type | true | integer | Order type, 1 market order, 2 limit order | 1,2 | |
price | true | string | Order price | ||
order_from | true | integer | Order source | 6 | |
client_oid | false | string | client order id |
If you are opening postions order and want to set a stop profit stop loss after the transaction, you can add the following parameters.
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
plan_type | true | integer | market order or limit order | 1 market order,2 limit order | |
profit_price | true | string | Stop-profit trigger price (The stop-profit trigger price must be greater than the order price if the limit price is extended. When the limit is short, the stop-profit trigger price should be less than the order price. The stop-profit trigger price must be higher than the latest price when the market is open. The stop-profit trigger price should be lower than the latest price when the market is open short.) | ||
loss_price | true | string | Stop-loss trigger price (when the limit is wide, the stop-loss trigger price must be less than the order price. When limit open short, stop loss trigger price should be greater than the order price. The stop-loss trigger price must be lower than the latest price when the market is open. The stop-loss trigger price should be higher than the latest price when the market is short.) | ||
exec_profit_price | false | string | Stop-profit mandate price (must be set if plan_type=2) | ||
exec_loss_price | false | string | Stop-profit mandate price (must be set if plan_type=2) |
Response
{
"state":0,
"order_id":"425510999949316", // order id
"client_oid":"1234567890", // client order id
"status":1, // Order status 1 waiting to be traded, 2 partly traded, 3 fully traded, 4 partly cancelled, 5 fully cancelled, 100 order failed
"cmd":"open" // ignore
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
order_id | order id |
client_oid | client order id |
status | Order status 1 waiting to be traded, 2 partly traded, 3 fully traded, 4 partly cancelled, 5 fully cancelled, 100 order failed |
Other fields | ignore |
4.Cancel order
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/close";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"order_id":"425510999949316"
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/close
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
order_id | true | string | order id |
Response
{
"state":0, // success
"result":"success",
"cmd":"close"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
Other fields | ignore |
5.Batch cancellation
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/closeBatch";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"order_ids":["2234567890","2234567891"]
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/closeBatch
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
order_ids | true | Array | Order id array |
Response
{
"state":0,// success
"result":"success",
"cmd":"close"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
Other fields | ignore |
6.Cancel all orders
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/closeAll";
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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/closeAll
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... |
Response
{
"state":0,// success
"result":"success",
"cmd":"closeAll"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
Other fields | ignore |
7.Place Stop-profit Stop-loss Order
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/planOpen";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
pair:"4BTC_USDT",
price: 58000,
trigger_price: 58000,
amount: 0.001,
side: 1,
plan_type: 1,
book_type: 1,
};
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",//
headers: {//
'content-type': 'application/json',
'bibox-api-key': apikey,
'bibox-api-sign': sign,
'bibox-timestamp': timestamp
},
body: cmd//
},
function optionalCallback(err, httpResponse, body) {
if (err) {
return console.error('upload failed:', err);
}
console.log(body)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/planOpen
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | false | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
price | true | string | book price | ||
trigger_price | true | string | trigger price | ||
amount | true | string | amount | ||
side | true | int | position side | 1Long、2Short | |
plan_type | true | int | Stop-profit or Stop-loss | 1Stop-profit、2Stop-loss | |
book_type | true | int | market order or limit order | 1market order,2limit order |
Response
{
"state":0,//
"result":"success",
"cmd":"planOpen"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
Other fields | ignore |
8.list Stop-profit Stop-loss Order
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/planOrderList";
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",//
headers: {//
'content-type': 'application/json',
'bibox-api-key': apikey,
'bibox-api-sign': sign,
'bibox-timestamp': timestamp
},
body: cmd//
},
function optionalCallback(err, httpResponse, body) {
if (err) {
return console.error('upload failed:', err);
}
console.log(body)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/planOrderList
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | false | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... |
Response
{
"state":0,
"result":[
{
"tt":1,
"pr":"49900",
"pt":1,
"pid":"0",
"q":"0.001",
"sd":2,
"r":0,
"bt":1,
"s":1,
"t":1638155219319,
"ui":100006,
"si":"0",
"pi":"4BTC_USDT",
"oi":"5198029",
"bid":"0",
"tp":"49900",
"otd":"0"
},
...
],
"cmd":"planOrderList"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
oi | order id |
pi | Contract symbol |
pr | book price |
tp | trigger price |
q | book quantity |
sd | Position side:1Long、2Short |
pt | Stop-profit or Stop-loss:1Stop-profit、2Stop-loss |
bt | market order or limit order:1market order,2limit order |
s | order status:1wait trigger、2triggered、3canceled、4triggered failed、5canceled |
Other fields | ignore |
9.Cancel Stop-profit Stop-loss Order
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/planClose";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"order_id":"425510999949316"
};
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",//
headers: {//
'content-type': 'application/json',
'bibox-api-key': apikey,
'bibox-api-sign': sign,
'bibox-timestamp': timestamp
},
body: cmd//
},
function optionalCallback(err, httpResponse, body) {
if (err) {
return console.error('upload failed:', err);
}
console.log(body)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/planClose
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
order_id | true | string | order id |
Response
{
"state":0, //
"result":"success",
"cmd":"planClose"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
Other fields | ignore |
10.Cancel all Stop-profit Stop-loss Order
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/planCloseAll";
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",//
headers: {//
'content-type': 'application/json',
'bibox-api-key': apikey,
'bibox-api-sign': sign,
'bibox-timestamp': timestamp
},
body: cmd//
},
function optionalCallback(err, httpResponse, body) {
if (err) {
return console.error('upload failed:', err);
}
console.log(body)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/planCloseAll
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | false | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... |
Response
{
"state":0,//
"result":"success",
"cmd":"planCloseAll"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
Other fields | ignore |
11.Adjust margin on a fixed position
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/changeMargin";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"pair":"4BTC_USDT",
"margin":"0.01",
"side":1
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/changeMargin
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
margin | true | string | margin | ||
side | true | integer | Position side, 1 long position, 2 short position | 1,2 |
Response
{
"state":3103, // failed
"msg":"没有持仓不支持该操作",
"cmd":"changeMargin"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
Other fields | ignore |
12.Adjust position mode and leverage
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/changeMode";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"pair":"4BTC_USDT",
"mode":2,
"leverage_long":10,
"leverage_short":20
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/changeMode
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
mode | true | integer | Position mode, 1 cross, 2 fixed | 1,2 | |
leverage_long | true | integer | Long leverage | 1~100 | |
leverage_short | true | integer | Short leverage | 1~100 |
Response
{
"state":0,
"result":"success",
"cmd":"changeMode"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
Other fields | ignore |
13.Query assets
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/assets";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
// "coin":"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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/assets
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
coin | false | string | coin symbol | BTC,ETH,... |
Response
{
"state":0,
"result":[
{ ff: '0',
b: '219311.9556',
c: 'USDT',
u: 100006,
mc: '93265.8573',
mf: '60.8824',
fc: '0' }
],
"cmd":"assets"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
b | Available Balance |
c | coin symbol |
u | user id |
ff | Fixed Position Frozen funds |
fc | Cross Position Frozen funds |
mf | Fixed Position margin |
mc | Cross Position margin |
Other fields | ignore |
14.Query position
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/position";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
// "pair":"4BTC_USDT",
// "side":1
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/position
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | false | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
side | false | integer | Position side, 1 long position, 2 short position | 1,2 |
Response
{
"state":0,
"result":[
{
"pt":"0",//ignore
"f":"0",//ignore
"l":"10", // leverage
"sd":1, // Position side, 1 Long, 2 Short
"pa":"0", //Alert price
"ui":100006,//user id
"fb0":"0",//ignore
"pf":"0",//Liquidation price
"md":2,//Position mode, 1 Cross, 2 Fixed
"lc":"0",// Can liquidate position value
"pi":"4BTC_USDT", // pair
"mg":"0", //margin
"hc":"0",// Position value = Contract number multiplied by contract value
"fb":"0",//ignore
"po":"0", //Open price
"pp":"0",
"ps":"0",
},
...
],
"cmd":"position"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
l | leverage |
sd | Position side, 1 Long, 2 Short |
pa | Alert price |
ui | user id |
pf | Liquidation price |
md | Position mode, 1 Cross, 2 Fixed |
lc | Can liquidate position value |
pi | pair |
mg | margin |
hc | Position value = Contract number multiplied by contract value |
po | Open price |
pp | Stop-profit quantity |
ps | Stop-loss quantity |
Other fields | ignore |
15.Query order list
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/list";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
// "pair":"4BTC_USDT",
// "order_side":1
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/list
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | false | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
order_side | true | integer | Order side, 1 open long, 2 open short, 3 close long, 4 close short | 1,2,3,4 |
Response
{
"state":0,
"result":{
"p":1,
"t":1,
"o":[
{
"f":"0", //fee
"dp":"0", //Deal price
"eq":"0", //Deal amount
"p":"11092", //Order price
"tif":0, // ignore
"q":"1", //Order quantity
"sd":1, //Order side
"r":0, //reason
"s":1, // status
"t":1602679944815, //time
"ui":100006, //user id
"fz":"0.0000091417", //Frozen funds
"fb0":"0", //Coupon deduction
"of":4, //order from
"pi":"4BTC_USDT", //pair
"oi":"426610511577093", // order id
"coi":"1602679943911", //clientoid
"fb":"0", //BIX deduction
"po":false //ignore
},
...
]
},
"cmd":"orderList"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
f | fee |
dp | Deal price |
eq | Deal amount |
p | Order price |
q | Order quantity |
sd | Order side |
r | Reason for failure |
s | Order status |
t | time |
ui | user id |
fz | Frozen funds |
fb0 | Coupon deduction |
of | Order source |
pi | pair |
oi | order id |
coi | Client order id |
fb | BIX deduction |
bt | Stop-profit and stop-loss orders: 1 market price, 2 limit price, Otherwise no stop-profit and stop-loss is set. |
tw | Stop earnings trigger price |
tl | Stop loss trigger price |
pw | Stop-profit order price (ignored if bt =1) |
pl | Stop loss order price (ignored if bt =1) |
Other fields | ignore |
16.Query order
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/detail";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"order_id":"426610511577093",
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/detail
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
order_id | true | string | order id |
Response
{
"state":0,
"result":{
"f":"0", //fee
"dp":"0", //Deal price
"eq":"0", //Deal amount
"p":"11092", //Order price
"tif":0, // ignore
"q":"1", //Order quantity
"sd":1, //Order side
"r":0, //reason
"s":1, // status
"t":1602679944815, //time
"ui":100006, //user id
"fz":"0.0000091417", //Frozen funds
"fb0":"0", //Coupon deduction
"of":4, //order from
"pi":"4BTC_USDT", //pair
"oi":"426610511577093", // order id
"coi":"1602679943911", //clientoid
"fb":"0", //BIX deduction
"po":false //ignore
},
"cmd":"orderDetail"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
f | fee |
dp | Deal price |
eq | Deal amount |
p | Order price |
q | Order quantity |
sd | Order side |
r | Reason for failure |
s | Order status |
t | time |
ui | user id |
fz | Frozen funds |
fb0 | Coupon deduction |
of | Order source |
pi | pair |
oi | order id |
coi | Client order id |
fb | BIX deduction |
bt | Stop-profit and stop-loss orders: 1 market price, 2 limit price, Otherwise no stop-profit and stop-loss is set. |
tw | Stop earnings trigger price |
tl | Stop loss trigger price |
pw | Stop-profit order price (ignored if bt =1) |
pl | Stop loss order price (ignored if bt =1) |
Other fields | ignore |
17. Batch query order
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/listBatch";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"order_ids":["426610511577093"],
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/listBatch
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
order_ids | true | Array | Order id array |
Response
{
"state":0,
"result":[
{
"f":"0", //fee
"dp":"0", //Deal price
"eq":"0", //Deal amount
"p":"11092", //Order price
"tif":0, // ignore
"q":"1", //Order quantity
"sd":1, //Order side
"r":0, //reason
"s":1, // status
"t":1602679944815, //time
"ui":100006, //user id
"fz":"0.0000091417", //Frozen funds
"fb0":"0", //Coupon deduction
"of":4, //order from
"pi":"4BTC_USDT", //pair
"oi":"426610511577093", // order id
"coi":"1602679943911", //clientoid
"fb":"0", //BIX deduction
"po":false //ignore
}
],
"cmd":"orderListBatch"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
f | fee |
dp | Deal price |
eq | Deal amount |
p | Order price |
q | Order quantity |
sd | Order side |
r | Reason for failure |
s | Order status |
t | time |
ui | user id |
fz | Frozen funds |
fb0 | Coupon deduction |
of | Order source |
pi | pair |
oi | order id |
coi | Client order id |
fb | BIX deduction |
bt | Stop-profit and stop-loss orders: 1 market price, 2 limit price, Otherwise no stop-profit and stop-loss is set. |
tw | Stop earnings trigger price |
tl | Stop loss trigger price |
pw | Stop-profit order price (ignored if bt =1) |
pl | Stop loss order price (ignored if bt =1) |
Other fields | ignore |
18.Query order list based on clientoid
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3/cbu/order/listBatchByClientOid";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"order_ids":["1602679943911"],
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3/cbu/order/listBatchByClientOid
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
order_ids | true | Array | Array of client order id |
Response
{
"state":0,
"result":[
{
"f":"0", //fee
"dp":"0", //Deal price
"eq":"0", //Deal amount
"p":"11092", //Order price
"tif":0, // ignore
"q":"1", //Order quantity
"sd":1, //Order side
"r":0, //reason
"s":1, // status
"t":1602679944815, //time
"ui":100006, //user id
"fz":"0.0000091417", //Frozen funds
"fb0":"0", //Coupon deduction
"of":4, //order from
"pi":"4BTC_USDT", //pair
"oi":"426610511577093", // order id
"coi":"1602679943911", //clientoid
"fb":"0", //BIX deduction
"po":false //ignore
}
],
"cmd":"orderListBatchByCLientOid"
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
f | fee |
dp | Deal price |
eq | Deal amount |
p | Order price |
q | Order quantity |
sd | Order side |
r | Reason for failure |
s | Order status |
t | time |
ui | user id |
fz | Frozen funds |
fb0 | Coupon deduction |
of | Order source |
pi | pair |
oi | order id |
coi | Client order id |
fb | BIX deduction |
bt | Stop-profit and stop-loss orders: 1 market price, 2 limit price, Otherwise no stop-profit and stop-loss is set. |
tw | Stop earnings trigger price |
tl | Stop loss trigger price |
pw | Stop-profit order price (ignored if bt =1) |
pl | Stop loss order price (ignored if bt =1) |
Other fields | ignore |
19.Get server time
- 1.Request path
GET https://api.bibox.com/v3/cbu/timestamp
Response
{
"time":"1602680518605"
}
- 2.Response field description
Name | Description |
---|---|
time | server time |
20.Qeury position holding changed records
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3.1/cquery/base_u/dealLog";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"pair": "4BTC_USDT",
"page": 1,
"size": 10,
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3.1/cquery/base_u/dealLog
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
page | true | integer | page number | 1,2, ... | |
size | true | integer | return size | 10,20, ... |
Response
{
"result":{
"count":3,
"page":1,
"items":[
{
"id":"1125899906842635654", // record id
"user_id":100006, // user id
"coin_symbol":"USDT",// coin symbol
"pair":"4BTC_USDT",// pair
"side":1,// Position side, 1 Long, 2 Short
"model":1,// Position model, 1Cross, 2Fixed
"log_type":1,// Record type, 1 open position, 2 close position, 3 lighten position to reduce risk level, 4 liquidate position, 5ADL
"hold_coin_dx":"1.0000000000",// Change in position
"hold_coin":"1.0000000000",// Position holding
"price_log":"11692.0000000000",// proposed price
"price_open":"11692.0000000000",// Average open price
"profit":"0.0000000000",// profit
"fee":"0.0000000599",// fee
"fee_bix":"0.0000000000",// BIX deduction
"fee_bix0":"0.0000000000", // Coupon deduction
"createdAt":"2020-10-14T03:00:08.000Z",// time
"updatedAt":"2020-10-14T03:00:08.000Z"
},
...
]
},
"state":0
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
id | record id |
user_id | user id |
coin_symbol | coin symbol |
pair | pair |
side | Position side, 1 Long, 2 Short |
model | Position model, 1Cross, 2Fixed |
log_type | Record type, 1 open position, 2 close position, 3 lighten position to reduce risk level, 4 liquidate position, 5ADL |
hold_coin_dx | Change in position |
hold_coin | Position holding |
price_log | proposed price |
price_open | Average open price |
profit | profit |
fee | fee |
fee_bix | BIX deduction |
fee_bix0 | Coupon deduction |
createdAt | time |
Other fields | ignore |
21.Query order deals detail
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3.1/cquery/base_u/orderDetail";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"orderId":"421112953438213",
"page":1,
"size":10
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3.1/cquery/base_u/orderDetail
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
orderId | true | long | order id | ||
page | true | integer | page number | 1,2, ... | |
size | true | integer | return size | 10,20, ... |
Response
{
"result":{
"count":1,
"page":1,
"items":[
{
"id":"1125899906842635651",// record id
"coin_symbol":"USDT",// coin symbol
"pair":"4BTC_USDT",// pair
"side":2,// Pending order side, 1 open long, 2 open short, 3 close long, 4 close short
"order_from":4,// Order source
"price":"10692.0000000000",// Pending order price
"deal_price":"11510.0000000000",// Deal price
"deal_coin":"1.0000000000",// Deal amount
"fee":"0.0000000608",// fee
"fee_bix":"0.0000000000",// BIX deduction
"fee_bix0":"0.0000000000",// Coupon deduction
"is_maker":0,// is maker
"createdAt":"2020-10-14T02:58:59.000Z"// time
}
]
}
"state":0
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
id | record id |
coin_symbol | coin symbol |
pair | pair |
side | Pending order side, 1 open long, 2 open short, 3 close long, 4 close short |
order_from | Order source |
price | Pending order price |
deal_price | Deal price |
deal_coin | Deal amount |
fee | fee |
fee_bix | BIX deduction |
fee_bix0 | Coupon deduction |
createdAt | time |
is_maker | is maker |
Other fields | ignore |
22.Query historical orders
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3.1/cquery/base_u/orderHistory";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"page": 1,
"size": 10,
"pair": "4BTC_USDT",
"side": 1,
"status": [3, 4, 5, 100],
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3.1/cquery/base_u/orderHistory
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | false | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
page | true | integer | page number | 1,2, ... | |
size | true | integer | return size | 10,20, ... | |
side | false | integer | Order side, 1 open long 2 open short 3 close long 4 close short | ||
status | false | Array | Order status, 1 uncompleted, 2 partially completed, 3 completely completed, 4 partially cancelled, 5 completely cancelled, 100 failed to place an order |
Response
{
"result":{
"count":1,
"page":1,
"items":[
{
"id":421112953438215,// order id
"user_id":100006,// user id
"coin_symbol":"USDT",// coin symbol
"pair":"4BTC_USDT",// pair
"side":1,// Order side, 1 open long 2 open short 3 close long 4 close short
"order_type":2,// Order type, 1 market price, 2 limit price
"price":"11692.0000000000",// Pending order price
"amount_coin":"1.0000000000",// Order quantity
"freeze":"0.0000000000",// Frozen funds
"price_deal":"11692.0000000000",// Average deal price
"deal_coin":"1.0000000000",// Deal amount
"deal_num":1,// Deal number
"fee":"0.0000000599",// fee
"fee_bix":"0.0000000000",// BIX deduction
"fee_bix0":"0.0000000000",// Coupon deduction
"status":3,// Order status, 1 uncompleted, 2 partially completed, 3 completely completed, 4 partially cancelled, 5 completely cancelled, 100 failed to place an order
"reason":0,// Reason for failure
"fee_rate_maker":"0.0007000000",// maker fee rate
"fee_rate_taker":"0.0007000000",// taker fee rate
"client_oid":1602644402806,// client order id
"order_from":4, // ignore
"createdAt":"2020-10-14T03:00:08.000Z",// created time
"updatedAt":"2020-10-14T03:00:08.000Z"// updated time
}
]
},
"state":0
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
id | order id |
user_id | user id |
coin_symbol | coin symbol |
pair | pair |
side | Pending order side, 1 open long, 2 open short, 3 close long, 4 close short |
order_type | Order type, 1 market price, 2 limit price |
price | Pending order price |
amount_coin | Order quantity |
freeze | Frozen funds |
price_deal | Average deal price |
deal_coin | Deal amount |
deal_num | Deal number |
fee | fee |
fee_bix | BIX deduction |
fee_bix0 | Coupon deduction |
status | Order status, 1 uncompleted, 2 partially completed, 3 completely completed, 4 partially cancelled, 5 completely cancelled, 100 failed to place an order |
reason | Reason for failure |
fee_rate_maker | maker fee rate |
fee_rate_taker | taker fee rate |
client_oid | client order id |
order_from | Order source |
createdAt | created time |
Other fields | ignore |
23.Query order
Request
let CryptoJS = require("crypto-js");
let request = require("request");
let url = "https://api.bibox.com/v3.1/cquery/base_u/orderById";
let apikey = "900625568558820892a8c833c33ebc8fd2701efe"; //your apikey
let secret = "c708ac3e70d115ec29efbee197330627d7edf842"; //your apikey secret
let param = {
"orderIds": ["421112953438213", "421112953438214"],
"clientOids": ["1602644402806", "1602644402811"],
};
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)
});
- 1.Request path
POST https://api.bibox.com/v3.1/cquery/base_u/orderById
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
orderIds | true | Array | Order id array | ||
clientOids | true | Array | Array of client order id |
Response
{
"result":[
{
"id":421112953438214,// order id
"user_id":100006,// user id
"coin_symbol":"USDT",// coin symbol
"pair":"4BTC_USDT",// pair
"side":1,// Order side, 1 open long 2 open short 3 close long 4 close short
"order_type":2,// Order type, 1 market price, 2 limit price
"price":"11692.0000000000",// Pending order price
"amount_coin":"1.0000000000",// Order quantity
"freeze":"0.0000000000",// Frozen funds
"price_deal":"11692.0000000000",// Average deal price
"deal_coin":"1.0000000000",// Deal amount
"deal_num":1,// Deal number
"fee":"0.0000000599",// fee
"fee_bix":"0.0000000000",// BIX deduction
"fee_bix0":"0.0000000000",// Coupon deduction
"status":3,// Order status, 1 uncompleted, 2 partially completed, 3 completely completed, 4 partially cancelled, 5 completely cancelled, 100 failed to place an order
"reason":0,// Reason for failure
"fee_rate_maker":"0.0007000000",// maker fee rate
"fee_rate_taker":"0.0007000000",// taker fee rate
"client_oid":1602644402806,// client order id
"order_from":4, // ignore
"createdAt":"2020-10-14T03:00:08.000Z",// created time
"updatedAt":"2020-10-14T03:00:08.000Z"// updated time
},
...
],
"state":0
}
- 3.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
id | order id |
user_id | user id |
coin_symbol | coin symbol |
pair | pair |
side | Pending order side, 1 open long, 2 open short, 3 close long, 4 close short |
order_type | Order type, 1 market price, 2 limit price |
price | Pending order price |
amount_coin | Order quantity |
freeze | Frozen funds |
price_deal | Average deal price |
deal_coin | Deal amount |
deal_num | Deal number |
fee | fee |
fee_bix | BIX deduction |
fee_bix0 | Coupon deduction |
status | Order status, 1 uncompleted, 2 partially completed, 3 completely completed, 4 partially cancelled, 5 completely cancelled, 100 failed to place an order |
reason | Reason for failure |
fee_rate_maker | maker fee rate |
fee_rate_taker | taker fee rate |
client_oid | client order id |
order_from | Order source |
createdAt | created time |
Other fields | ignore |
24.Qeury fund fee rate
- 1.Request path
GET https://api.bibox.com/v3.1/cquery/buFundRate
Response
{
"result":{
"4BTC_USDT":{
"pair":"4BTC_USDT",
"close":"0.0000000000",
"fund_rate":"0.0001000000",
"createdAt":"2020-10-14T00:00:00.000Z"
},
"4ETH_USDT":{
"pair":"4ETH_USDT",
"close":"0.0000000000",
"fund_rate":"0.0001000000",
"createdAt":"2020-10-14T00:00:00.000Z"
}
},
"state":0
}
- 2.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
pair | pair |
fund_rate | fund fee rate |
Other fields | ignore |
25.Qeury tag price
- 1.Request path
GET https://api.bibox.com/v3.1/cquery/buTagPrice
Response
{
"result":{
"4BTC_USDT":{//pair
"close":"11453.7224909000",// Index price
"priceTag":"11454.2951770245",// Tag price
"createdAt":"2020-10-14T03:41:08.000Z" // time
},
"4ETH_USDT":{
"close":"383.1999999600",
"priceTag":"383.2191599600",
"createdAt":"2020-10-14T03:41:08.000Z"
}
},
"state":0
}
- 2.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
result | The keyword is pair |
close | Index price |
priceTag | Tag price |
createdAt | time |
Other fields | ignore |
26.Query basic contract information
- 1.Request path
GET https://api.bibox.com/v3.1/cquery/buValue
Response
{
"result":[
{
"id":304,
"pair":"4BTC_USDT",
"coin_symbol":"USDT",
"leverage_init":"10.0000000000",
"leverage_min":"0.0100000000",
"leverage_max":"150.0000000000",
"value":"0.0001000000",
"risk_level_base":"1.0000000000",
"risk_level_dx":"1.0000000000",
"maker_fee":"0.0002000000",
"taker_fee":"0.0005500000",
"open_max_per":"100.0000000000",
"pending_max":100,
"hold_max":"100.0000000000",
"price_precision":1
},
...
],
"state":0
}
- 2.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
pair | pair |
leverage_min | Minimum leverage |
leverage_max | Maximum leverage |
value | contract value |
maker_fee | default maker fee rate |
taker_fee | default taker fee rate |
open_max_per | Maximum number of single pending orders |
pending_max | Maximum number of pending orders |
hold_max | Maximum position value |
Other fields | ignore |
27.Query accuracy configuration
- 1.Request path
GET https://api.bibox.com/v3.1/cquery/buUnit
Response
{
"result":[
{
"pair":"4BTC_USDT",//pair
"price_unit":1,//Decimal points for order
"vol_unit":6, // ignore
"value_unit":0 // ignore
},
...
],
"state":0
}
- 2.Response field description
Name | Description |
---|---|
state | 0 means success, otherwise means failure |
pair | pair |
price_unit | Decimal points for order |
Other fields | ignore |
28.Query Kline
1.Request path
GET https://api.bibox.com/v2/mdata/kline?pair=4BTC_USDT&period=1min&size=10
2.Request parameter
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 | 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"
}
- 3.Response field description
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 |
29.Query market depth
- 1.Request path
GET https://api.bibox.com/v2/mdata/depth?pair=4BTC_USDT&size=10
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | pair | 4BTC_USDT, 4ETH_USDT, ... | |
size | false | integer | 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"
}
- 3.Response field description
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 |
30.Subscription to Kline
Example
const WebSocket = require('ws');
const zlib = require('zlib');
const biboxws = 'wss://npush.bibox360.com/cbu';
let wsClass = function () {
};
wsClass.prototype._decodeMsg = function (data) {
let data1 = data.slice(1, data.length);
zlib.unzip(data1, (err, buffer) => {
if (err) {
console.log(err);
} else {
try {
let res = JSON.parse(buffer.toString());
console.log(3, new Date(), buffer.toString());
} catch (e) {
console.log(e);
}
}
});
};
wsClass.prototype._initWs = async function () {
let that = this;
console.log(biboxws)
let ws = new WebSocket(biboxws);
that.ws = ws;
ws.on('open', function open() {
console.log(new Date(), 'open')
{// kline
ws.send(JSON.stringify({
event: 'addChannel',
sub: '4BTC_USDT_kline_1min',
}));
}
});
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 => {
if (data[0] == '1') {
that._decodeMsg(data);
} else if (data[0] == '0') {
console.log(1, new Date(), JSON.parse(data.slice(1)));
} else {
console.log(2, new Date(), data);
}
});
};
let instance = new wsClass();
instance._initWs().catch(err => {
console.log(err);
});
- 1.Subscription path
wss://npush.bibox360.com/cbu
- 2.Request parameter
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 | |
sub | true | string | ${pair} + '_kline_' + ${period} |
Response
{
topic: '4BTC_USDT_kline_1min',
t: 1,
d: [
[
'1639122420000',
'47868.1',
'47892.3',
'47825.4',
'47825.4',
'10.86'
],
[
'1639122480000',
'47825.4',
'47830.9',
'47728.7',
'47775.6',
'10.88'
]
]
}
- 3.Response field description
[ k-line start time, Deal number, Opening price, Highest price, Lowest price, Closing price, Volume(Contract value) ]
31.Subscription to Tag price
Example
const WebSocket = require('ws');
const zlib = require('zlib');
const biboxws = 'wss://npush.bibox360.com/cbu';
let wsClass = function () {
};
wsClass.prototype._decodeMsg = function (data) {
let data1 = data.slice(1, data.length);
zlib.unzip(data1, (err, buffer) => {
if (err) {
console.log(err);
} else {
try {
let res = JSON.parse(buffer.toString());
console.log(3, new Date(), buffer.toString());
} catch (e) {
console.log(e);
}
}
});
};
wsClass.prototype._initWs = async function () {
let that = this;
console.log(biboxws)
let ws = new WebSocket(biboxws);
that.ws = ws;
ws.on('open', function open() {
console.log(new Date(), 'open')
{// kline
ws.send(JSON.stringify({
event: 'addChannel',
sub: '4BTC_USDTTAGPRICE_kline_1min',
}));
}
});
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 => {
if (data[0] == '1') {
that._decodeMsg(data);
} else if (data[0] == '0') {
console.log(1, new Date(), JSON.parse(data.slice(1)));
} else {
console.log(2, new Date(), data);
}
});
};
let instance = new wsClass();
instance._initWs().catch(err => {
console.log(err);
});
- 1.Subscription path
wss://npush.bibox360.com/cbu
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | pair | 4BTC_USDT, 4ETH_USDT | |
sub | true | string | ${pair} + 'TAGPRICE_kline_1min' |
Response
{
topic: '4BTC_USDTTAGPRICE_kline_1min',
t: 1,
d: [
[
'1639123440000',
'47744.46219748',
'47744.46219748',
'47678.11820096',
'47685.89214597',
'30'
],
[
'1639123500000',
'47683.92095634',
'47707.9817466',
'47683.25428563',
'47705.7285557',
'28'
]
]
}
- 3.Response field description
[ k-line start time, Deal number, Opening price, Highest price, Lowest price, Latest price, Volume(ignore) ]
32.Subscription to Market depth
Example
const WebSocket = require('ws');
const zlib = require('zlib');
const biboxws = 'wss://npush.bibox360.com/cbu';
let wsClass = function () {
};
wsClass.prototype._decodeMsg = function (data) {
let data1 = data.slice(1, data.length);
zlib.unzip(data1, (err, buffer) => {
if (err) {
console.log(err);
} else {
try {
let res = JSON.parse(buffer.toString());
console.log(3, new Date(), buffer.toString());
} catch (e) {
console.log(e);
}
}
});
};
wsClass.prototype._initWs = async function () {
let that = this;
console.log(biboxws)
let ws = new WebSocket(biboxws);
that.ws = ws;
ws.on('open', function open() {
console.log(new Date(), 'open')
{// kline
ws.send(JSON.stringify({
event: 'addChannel',
sub: '4BTC_USDT_depth',
}));
}
});
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 => {
if (data[0] == '1') {
that._decodeMsg(data);
} else if (data[0] == '0') {
console.log(1, new Date(), JSON.parse(data.slice(1)));
} else {
console.log(2, new Date(), data);
}
});
};
let instance = new wsClass();
instance._initWs().catch(err => {
console.log(err);
});
- 1.Subscription path
wss://npush.bibox360.com/cbu
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | pair | 4BTC_USDT, 4ETH_USDT | |
sub | true | string | ${pair} + '_depth' |
Response
{
"topic":"4BTC_USDT_depth",
"t":0,
"d":{
"pair":"4BTC_USDT",
"ut":1639124171584,
"seq":188236,
"asks":[
[
"7.904",
"47741.6"
],
[
"0.604",
"47741.8"
]
],
"bids":[
[
"1.667",
"47741.3"
],
[
"0.534",
"47726.8"
]
]
}
}
{
"topic":"4BTC_USDT_depth",
"t":1,
"d":{
"pair":"4BTC_USDT",
"ut":1639124172771,
"seq":188240,
"add":{
"asks":[
[
"0.11",
"47744.9"
]
],
"bids":[
[
"0.809",
"47741.5"
]
]
},
"del":{
"asks":null,
"bids":[
[
"0.522",
"47741.3"
]
]
}
}
}
- 3.Response field description
Name | Description |
---|---|
pair | pair |
update_time | time |
seq | pair |
add | add data |
del | delete data |
mod | modify data |
asks | ask data |
bids | bid data |
volume | Order quantity |
price | price |
Other fields | ignore |
33.Subscription to deals detail
Example
const WebSocket = require('ws');
const zlib = require('zlib');
const biboxws = 'wss://npush.bibox360.com/cbu';
let wsClass = function () {
};
wsClass.prototype._decodeMsg = function (data) {
let data1 = data.slice(1, data.length);
zlib.unzip(data1, (err, buffer) => {
if (err) {
console.log(err);
} else {
try {
let res = JSON.parse(buffer.toString());
console.log(3, new Date(), buffer.toString());
} catch (e) {
console.log(e);
}
}
});
};
wsClass.prototype._initWs = async function () {
let that = this;
console.log(biboxws)
let ws = new WebSocket(biboxws);
that.ws = ws;
ws.on('open', function open() {
console.log(new Date(), 'open')
{// kline
ws.send(JSON.stringify({
event: 'addChannel',
sub: '4BTC_USDT_deals',
}));
}
});
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 => {
if (data[0] == '1') {
that._decodeMsg(data);
} else if (data[0] == '0') {
console.log(1, new Date(), JSON.parse(data.slice(1)));
} else {
console.log(2, new Date(), data);
}
});
};
let instance = new wsClass();
instance._initWs().catch(err => {
console.log(err);
});
- 1.Subscription path
wss://npush.bibox360.com/cbu
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | pair | 4BTC_USDT, 4ETH_USDT | |
sub | true | string | '${pair} + '_deals' |
Response
{
"topic":"4BTC_USDT_deals",
"t":0,
"d":{
"pair":"4BTC_USDT",
"d":[
[
"48008.1",
"0.009",
"1",
"1639124930499",
""
],
[
"48006.5",
"0.021",
"1",
"1639124930328",
""
]
]
}
}
{
topic: '4BTC_USDT_deals',
t: 1,
d: [
"48008.1",
"0.009",
"1",
"1639124930499",
""
]
}
- 3.Response field description
[ Deal price, Deal amount, trade side(1 buy, 2 sell), Timestamp ]
34.Subscription to ticker
Example
const WebSocket = require('ws');
const zlib = require('zlib');
const biboxws = 'wss://npush.bibox360.com/cbu';
let wsClass = function () {
};
wsClass.prototype._decodeMsg = function (data) {
let data1 = data.slice(1, data.length);
zlib.unzip(data1, (err, buffer) => {
if (err) {
console.log(err);
} else {
try {
let res = JSON.parse(buffer.toString());
console.log(3, new Date(), buffer.toString());
} catch (e) {
console.log(e);
}
}
});
};
wsClass.prototype._initWs = async function () {
let that = this;
console.log(biboxws)
let ws = new WebSocket(biboxws);
that.ws = ws;
ws.on('open', function open() {
console.log(new Date(), 'open')
{// kline
ws.send(JSON.stringify({
event: 'addChannel',
sub: '4BTC_USDT_ticker',
}));
}
});
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 => {
if (data[0] == '1') {
that._decodeMsg(data);
} else if (data[0] == '0') {
console.log(1, new Date(), JSON.parse(data.slice(1)));
} else {
console.log(2, new Date(), data);
}
});
};
let instance = new wsClass();
instance._initWs().catch(err => {
console.log(err);
});
- 1.Subscription path
wss://npush.bibox360.com/cbu
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | pair | 4BTC_USDT, 4ETH_USDT | |
sub | true | string | ${pair} + '_ticker' |
Response
{
"topic":"4BTC_USDT_ticker",
"t":1,
"d":[
"4BTC_USDT",
"48099.9",
"48099.90",
"299951.30",
"49631.3",
"47319.1",
"48095.1",
"0.041",
"48098.1",
"2.292",
"16781.668",
"-2.83%",
"1639125637999",
"299951.30000000"
]
}
- 3.Response field description
[ pair, last price, last cny price, last usd price, 24hHighest price, 24hLowest price, Latest bid price, Latest bid amount, Latest ask price, Latest ask amount, 24hDeal amount, 24h Quote change, Timestamp, Latest cny price ]
35.Subscription to user data
Example
'use strict'
const WebSocket = require('ws');
const zlib = require('zlib');
let CryptoJS = require("crypto-js");
const biboxws = 'wss://npush.bibox360.com/cbu'; // 1.Request path
let ws;
let apikey = '900625568558820892a8c833c33ebc8fd2701efe'; // your apikey
let secret = 'c708ac3e70d115ec29efbee197330627d7edf842'; // apikey的密码
let subparam = JSON.stringify({ // .Format the parameter object, get subparam
apikey,
sub: 'ALL_ALL_login'
});
let sign = CryptoJS.HmacMD5(subparam, String(secret)).toString(); // Use apikey's secret to sign subparam with HmacMD5, and get the signature result sign
let form = { // 2.Request parameter
apikey,
sign,
sub: 'ALL_ALL_login',
};
console.log('form', form)
let reiniting = false;
let resend = function (user_id) {
if (ws.readyState != WebSocket.OPEN) {
return setTimeout(function () {
resend(user_id);
}, 1000 * 10);
}
ws.send(JSON.stringify(form));
};
setInterval(function () {
if (ws && ws.readyState == WebSocket.OPEN) {
ws.ping(new Date().getTime());
}
}, 1000 * 10);
let reinit = function () {
if (reiniting) {
return;
}
reiniting = true;
try {
if (ws && ws.readyState == WebSocket.OPEN) {
console.log('manu close ')
ws.close();
}
} catch (err) {
}
setTimeout(function () {
init();
}, 1000 * 30);
};
let init = function (user_id) {
console.log('init', user_id);
reiniting = false;
ws = new WebSocket(biboxws);
setTimeout(function () {
if (!ws || ws.readyState != WebSocket.OPEN) {
reinit(user_id);
}
}, 1000 * 60);
ws.on('open', function open() {
resend(user_id);
});
ws.on('close', err => {
console.log('close, ', err);
reinit(user_id);
});
ws.on('error', err => {
console.log('error', err);
reinit(user_id);
});
ws.on('ping', err => {
console.log('ping on', err.toString('utf8'));
});
ws.on('pong', err => {
// console.log('pong ', err.toString('utf8'));
});
ws.on('message', function incoming(data) {
if (data[0] == '1') {
decodeMsg(data);
} else {
console.log(1, JSON.parse(data));
}
});
};
let login = function () {
if (reiniting) {
return;
}
reiniting = false;
init();
};
let decodeMsg = function (data) {
let data1 = data.slice(1, data.length);
zlib.unzip(data1, (err, buffer) => {
if (err) {
console.log('2', err);
} else {
try {
let res = JSON.parse(buffer.toString());
console.log('3', buffer.toString());
} catch (e) {
console.log('4', e);
}
}
});
};
module.exports = {};
login();
- 1.Request path
wss://npush.bibox360.com/cbu
- 2.Request parameter
Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
apikey | true | string | your apikey | ||
sign | true | string | sign | ||
sub | true | string | 'ALL_ALL_login' |
- 3.Signature method
1.Define the parameter object param, need to use apikey
let apikey = 'this is your apikey';
let param = { "apikey": apikey, "sub": "ALL_ALL_login" };
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 = 'this is your apikey secret';
let sign = CryptoJS.HmacMD5(strParam, secret).toString();
4.Generate subscription parameters wsparam
let wsparam = { "apikey": apikey, "sign": sign, "sub": "ALL_ALL_login", };
Response
{
"topic":"ALL_ALL_login",
"uid":"1000000",
"t":0,
"d":{
"result":"订阅成功"
}
}
- 4.Response field description
Name | Description |
---|---|
result | "订阅成功" means subscription success |
Other fields | ignore |
36.Get assets from subscribed user data
- 1.Key field
contract_assets or assets_all
Response
{
"topic":"ALL_ALL_login",
"uid":"10000",
"t":0,
"d":{
"assets_all":[
{
"ff":"0",
"b":"2050.8565",
"c":"USDT",
"t":1639123200000,
"u":11008936,
"v":62938352964,
"mc":"261.3161",
"mf":"0",
"fc":"0"
}
]
}
}
{
"topic":"ALL_ALL_login",
"uid":"100006",
"t":1,
"d":{
"contract_assets":{
"ff":"0",
"b":"1862.4156",
"c":"USDT",
"t":1639128405433,
"u":100006,
"v":108774606,
"mc":"130.6414",
"mf":"0",
"fc":"6.0756"
}
}
}
- 2.Response field description
Name | Description |
---|---|
b | Available Balance |
c | coin symbol |
u | user id |
ff | Fixed Position Frozen funds |
fc | Cross Position Frozen funds |
mf | Fixed Position margin |
mc | Cross Position margin |
Other fields | ignore |
37.Get position from subscribed user data
- 1.Key field
contract_order or position_all
Response
{
"topic":"ALL_ALL_login",
"uid":"100006",
"t":0,
"d":{
"position_all":[
{
"pp":"0",
"ps":"0",
"pt":"-0.0886026273",
"sd":1,
"ui":100006,
"md":1,
"mg":"72.825",
"id":"1125899906842624043",
"sp":0,
"ut":1639123200000,
"cc":"0",
"st":0,
"f":"0.4344",
"l":"10",
"pa":"0",
"pc":"0",
"t":1638177636516,
"fb0":"0",
"v":108181199,
"pf":"0",
"lc":"0.013",
"pi":"4BTC_USDT",
"hc":"0.013",
"fb":"0",
"po":"55700.1923076923"
}
]
}
}
{
"topic":"ALL_ALL_login",
"uid":"100006",
"t":1,
"d":{
"contract_order":{
"pp":"0",
"ps":"0",
"pt":"-0.0886026273",
"sd":1,
"ui":100006,
"md":1,
"mg":"72.825",
"id":"1125899906842624043",
"sp":0,
"ut":1639128405433,
"cc":"0",
"st":0,
"f":"0.4344",
"l":"10",
"pa":"0",
"pc":"0",
"t":1638177636516,
"fb0":"0",
"v":108774604,
"pf":"0",
"lc":"0.013",
"pi":"4BTC_USDT",
"hc":"0.013",
"fb":"0",
"po":"55700.1923076923"
}
}
}
- 2.Response field description
Name | Description |
---|---|
l | leverage |
sd | Position side, 1 Long, 2 Short |
pa | Alert price |
ui | user id |
pf | Liquidation price |
md | Position mode, 1 Cross, 2 Fixed |
lc | Can liquidate position value |
pi | pair |
mg | margin |
hc | Position value = Contract number multiplied by contract value |
po | Open price |
pp | Stop-profit quantity |
ps | Stop-loss quantity |
Other fields | ignore |
38.Get order from subscribed user data
- 1.Key field
contract_pending or order_all
Response
{
"topic":"ALL_ALL_login",
"uid":"100006",
"t":0,
"d":{
"order_all":[
{
"tt":0,
"tw":"0",
"pw":"0",
"dp":"0",
"tif":0,
"sd":2,
"bt":0,
"ui":100006,
"fz":"6.0756",
"of":6,
"oi":"17592186044417",
"ot":2,
"f":"0",
"eq":"0",
"p":"60000",
"q":"0.001",
"tpl":"0",
"r":0,
"s":1,
"t":1639128405433,
"pd":"0",
"fb0":"0",
"tl":"0",
"pi":"4BTC_USDT",
"tpw":"0",
"coi":"1639128409489",
"fb":"0",
"pl":"0",
"po":false
}
]
}
}
{
"topic":"ALL_ALL_login",
"uid":"100006",
"t":1,
"d":{
"contract_pending":{
"tt":0,
"tw":"0",
"pw":"0",
"dp":"0",
"tif":0,
"sd":2,
"bt":0,
"ui":100006,
"fz":"6.0756",
"of":6,
"oi":"17592186044417",
"ot":2,
"f":"0",
"eq":"0",
"p":"60000",
"q":"0.001",
"tpl":"0",
"r":0,
"s":1,
"t":1639128405433,
"pd":"0",
"fb0":"0",
"tl":"0",
"pi":"4BTC_USDT",
"tpw":"0",
"coi":"1639128409489",
"fb":"0",
"pl":"0",
"po":false
}
}
}
- 2.Response field description
Name | Description |
---|---|
f | fee |
dp | Deal price |
eq | Deal amount |
p | Order price |
q | Order quantity |
sd | Order side |
r | Reason for failure |
s | Order status |
t | time |
ui | user id |
fz | Frozen funds |
fb0 | Coupon deduction |
of | Order source |
pi | pair |
oi | order id |
coi | Client order id |
fb | BIX deduction |
Other fields | ignore |
39.Get deals detail from subscribed user data
- 1.Key field
contract_detail
Response
{
"topic":"ALL_ALL_login",
"uid":"100006",
"t":1,
"d":{
"contract_detail":{
"oi":"432108069715999",//Order id
"ui":"100006",//user id
"id":"1125899906842648855",//deals detail id
"coi":"1602750117684",//client order id
"pi":"4BTC_USDT",//pair
"sd":1,//
"s":3,//
"ot":2,
"of":4,// Order source
"q":"1",
"p":"11692",//Pending order price
"dp":"10655",//Deal price
"ep":"1",
"f":"0.0000000657",//fee
"fb":"0",//BIX deduction
"fb0":"0",//Coupon deduction
"im":0,//is maker
"t":1602750121093, //time
}
}
}
- 2.Response field description
Name | Description |
---|---|
oi | order id |
ui | user id |
id | record id |
coi | Client order id |
pi | pair |
sd | Order side |
of | Order source |
p | Order price |
dp | Deal price |
f | fee |
fb0 | Coupon deduction |
fb | BIX deduction |
im | is maker |
t | time |
Other fields | ignore |
40.Get passive changes in positions from subscribed user data
- 1.Key field
contract_deal_log
Response
{
"topic":"ALL_ALL_login",
"uid":"100006",
"t":1,
"d":{
"contract_deal_log":{
"id":"1125899906842654296",// record id
"user_id":100006,//user id
"type":5,//Change type, 1 open position, 2 close position, 3 lighten position to reduce risk level, 4 liquidate position, 5ADL
"mode":2,//Position model, 1Cross, 2Fixed
"pair":"4BTC_USDT",//pair
"price":"11247.6",//proposed price
"hold_dx":"1",//Change in position
"order_side":2,// Position side, 1Long, 2Short
"time":1602755131000, //time
}
}
}
- 2.Response field description
Name | Description |
---|---|
id | record id |
user_id | user id |
type | Change type, 1 open position, 2 close position, 3 lighten position to reduce risk level, 4 liquidate position, 5ADL |
mode | Position model, 1Cross, 2Fixed |
pair | pair |
price | proposed price |
hold_dx | Change in position |
order_side | Position side, 1Long, 2Short |
time | time |
Other fields | ignore |
41.Get Stop-profit Stop-loss Order from subscribed user data
- 1.Key field
base_u_plan_order_v3
Response
{
"topic":"ALL_ALL_login",
"uid":"100006",
"t":1,
"d":{
"base_u_plan_order_v3":{
"tt":1,
"pr":"49900",
"pt":1,
"pid":"0",
"q":"0.001",
"sd":2,
"r":0,
"bt":1,
"s":1,
"t":1638157434782,
"ui":100006,
"si":"0",
"pi":"4BTC_USDT",
"oi":"5226915",
"bid":"0",
"tp":"49900",
"otd":"0"
}
}
}
- 2.Response field description
Name | Description |
---|---|
oi | order id |
pi | Contract symbol |
pr | book price |
tp | trigger price |
q | book quantity |
sd | Position side:1Long、2Short |
pt | Stop-profit or Stop-loss:1Stop-profit、2Stop-loss |
bt | market order or limit order:1market order,2limit order |
s | order status:1wait trigger、2triggered、3canceled、4triggered failed、5canceled |
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 |