-
Notifications
You must be signed in to change notification settings - Fork 3
REST_API_Reference_C
Important: For full request format, please refer to the description of API request, return format, the following API interface description is not full.
Table of Contents
-
contract account information (apikey required)
- check contract funds
- check single information of contract position
- Check all information of contract position
- Check uncompleted contract orders
- make contract order
- make bulk contract orders
- cancel contract order
- cancel multiple orders
- cancel 1000 orders
- adjust contract leverage
- adjust contract margin
- transfer funds from master account to contract account
- check transaction records in the market
- check uncompleted orders through order number
- check personal transaction record
- query order detail
- query contract value (apikey not required)
- query contract leverage info (apikey not required)
- query contract open limit once (apikey not required)
POST https://api.bibox.com/v1/cquery
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|
POST request method:query/assets
The description of return result
{
"result":[
{
"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"
},
"cmd":"query/assets"
}
]
}
example
// Request
{
"cmd":"query/assets",
"body":{
}
}
// Response
{
"result":[
{
"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"
},
"cmd":"query/assets"
}
]
}
POST https://api.bibox.com/v1/cquery
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | contract symbol | 4BTC_USDT,4ETH_USDT, ... |
POST request method:query/order
The description of return result
{
"result":[
{
"result":{
"coin_symbol":"USDT",
"pair":"4BTC_USDT", // contract symbol
"contract":2, // position size
"margin":"1.5612", // margin
"profit":"-2.4995",
"price":"3903.0450", // average price of opening position
"order_side":2, // side: 1long, 2short
"price_force":"3961.5907", // forced liquidation price
"floatProfit":"-0.1376",
"leverage":50, // 0:cross-margin, others: fixed leverage
"icontract_up":2, // uncompleted orders in long position
"icontract_down":0 // uncompleted orders in short position
},
"cmd":"query/order"
}
]
}
example
// Request
{
"cmd":"query/order",
"body":{
"pair":"4BTC_USDT" // contract symbol:BTCUSDT Perpetual Contract symbol is 4BTC_USDT,ETHUSDT Perpetual Contract symbol is 4ETH_USDT 。。。
}
}
// Response
{
"result":[
{
"result":{
"coin_symbol":"USDT",
"pair":"4BTC_USDT",
"contract":2,
"margin":"1.5612",
"profit":"-2.4995",
"price":"3903.0450",
"order_side":2,
"price_force":"3961.5907",
"floatProfit":"-0.1376",
"leverage":50,
"icontract_up":2,
"icontract_down":0
},
"cmd":"query/order"
}
]
}
POST https://api.bibox.com/v1/cquery
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... |
POST request method:query/orderAll
The description of return result
{
"result":[
{
"result":[
{
"coin_symbol":"USDT",
"pair":"4BTC_USDT", // Contract symbol
"contract":2, // position size
"margin":"1.5612", // margin
"profit":"-2.4995",
"price":"3903.0450", // average price of opening position
"order_side":2, // position side: 1long, 2short
"price_force":"3961.5907", // forced liquidation price
"floatProfit":"-0.1376",
"leverage":50, // 0:cross-margin, others: fixed leverage
"icontract_up":2, // uncompleted Cont of limit order in long position
"icontract_down":0 // uncompleted Cont of limit order in short position
},
...
],
"cmd":"query/orderAll"
}
]
}
example
// Request
{
"cmd":"query/orderAll",
"body":{
}
}
// Response
{
"result":[
{
"result":[
{
"coin_symbol":"USDT",
"pair":"4BTC_USDT",
"contract":2,
"margin":"1.5612",
"profit":"-2.4995",
"price":"3903.0450",
"order_side":2,
"price_force":"3961.5907",
"floatProfit":"-0.1376",
"leverage":50,
"icontract_up":2,
"icontract_down":0
},
{
"coin_symbol":"USDT",
"pair":"4ETH_USDT",
"contract":6,
"margin":"0.1714",
"profit":"0.0668",
"price":"142.8816",
"order_side":2,
"price_force":"145.0248",
"floatProfit":"0.0063",
"leverage":50,
"icontract_up":6,
"icontract_down":0
}
],
"cmd":"query/orderAll"
}
]
}
POST https://api.bibox.com/v1/cquery
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
page | true | integer | page | 1,2, ... | |
size | true | integer | number | 10,20, ... | |
pair | false | string | contract symbol | 4BTC_USDT,4ETH_USDT, ... |
POST request method:query/orderPending
The description of return result
{
"result":[
{
"result":{
"count":3,
"page":1,
"items":[
{
"id":491168, // order number
"coin_symbol":"USDT",
"pair":"4ETH_USDT", // contract symbol
"order_side":1, // position side: 1long, 2short
"order_type":2,
"contract":3, // number of orders
"order_from":1,
"status":1, // 0,1:uncompleted; 2:partly completed; 3:completed; 4: partly cancel; 5 cancel completed; 6,7 system cancel;
"price":"136.0000", // order price
"price_deal":"0.0000", // average transaction price
"deal_count":0,
"contract_deal":0, // number of completed orders
"createdAt":"2019-02-20T02:01:46.000Z",
"updatedAt":"2019-02-20T02:01:46.000Z"
},
...
]
},
"cmd":"query/orderPending"
}
]
}
example
// Request
{
"cmd":"query/orderPending",
"body":{
"page":1,
"size":20,
"pair":""
}
}
// Response
{
"result":[
{
"result":{
"count":3,
"page":1,
"items":[
{
"id":491168,
"coin_symbol":"USDT",
"pair":"4ETH_USDT",
"order_side":1,
"order_type":2,
"contract":3,
"order_from":1,
"status":1,
"price":"136.0000",
"price_deal":"0.0000",
"deal_count":0,
"contract_deal":0,
"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"
}
]
},
"cmd":"query/orderPending"
}
]
}
POST https://api.bibox.com/v1/ctrade
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
order_type | true | integer | order type | 1:market price 2:limited price | |
leverage | true | integer | leverage | cross margin:0, fixed margin:1,2,... | |
cross_leverage | false | integer | cross leverage | 25 | when leverage=0 and cross_leverage=1,2,...50 |
order_side | true | integer | position side | 1:long, 2:short | |
price | true | string | order price | The numbers greater than 0 | |
contract | true | string | Cont | 1,2, ... | |
pair | true | string | contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
order_from | true | integer | 6 | 6 | |
client_oid | false | Long | client order id | > 0 |
POST request method:order/open
The description of return result
{
"result":[
{
result: '17592186044786', // order id
client_oid: '123456789', // client order id
cmd: 'order/open',
}
]
}
example
// Request
{
"cmd":"order/open",
"body":{
"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',
}
}
// Response
{
"result":[
{
result: '17592186044786', // order id
client_oid: '123456789', // client order id
cmd: 'order/open',
}
]
}
POST https://api.bibox.com/v1/ctrade
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
leverage | true | integer | leverage | cross margin:0, fixed margin:1,2,... | |
cross_leverage | false | integer | cross leverage | 25 | when leverage=0 and cross_leverage=1,2,...50 |
order_side | true | integer | position side | 1:long, 2:short | |
price | true | string | order price | The numbers greater than 0 | |
contract | true | string | Cont | 1,2, ... | |
pair | true | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
client_oid | false | Long | client order id | > 0 |
POST request method:order/openBatch
The description of return result
{
"result":[
{
"result":[
{
code: 0, // 0 means success;non-zero means failure, code is error code
id: '17592186044787', // order id
msg: '',
client_oid: '123456787'
},
...
],
"cmd":"order/openBatch"
}
]
}
example
// Request
{
"cmd":"order/openBatch",
"body":{
"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'
}
]
}
}
// Response
{
"result":[
{
"result":[
{
code: 0,
id: '17592186044789',
msg: '',
client_oid: '123456787'
},
{
code: 0,
id: '17592186044790',
msg: '',
client_oid: '123456788'
}
],
"cmd":"order/openBatch"
}
]
}
POST https://api.bibox.com/v1/ctrade
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
order_id | true | integer | order id |
POST request method:order/close
The description of return result
{
"result":[
{
"result":"success",
"cmd":"order/close"
}
]
}
example
// Request
{
"cmd":"order/close",
"body":{
"order_id":574954
}
}
// Response
{
"result":[
{
"result":"success",
"cmd":"order/close"
}
]
}
POST https://api.bibox.com/v1/ctrade
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
order_ids | true | integer | order number array |
POST request method:order/closeBatch
The description of return result
{
"result":[
{
"result":"success",
"cmd":"order/closeBatch",
"index":13
}
]
}
example
// Request
{
"cmd":"order/closeBatch",
"body":{
"order_ids":[
574953,
574954
]
},
"index":13
}
// Response
{
"result":[
{
"result":"success",
"cmd":"order/closeBatch",
"index":13
}
]
}
POST https://api.bibox.com/v1/ctrade
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | false | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... |
POST request method:order/closeAll
The description of return result
{
"result":[
{
"result":"success",
"cmd":"order/closeAll",
"index":13
}
]
}
example
// Request
{
"cmd":"order/closeAll",
"body":{
"pair":"4BTC_USDT"
},
"index":13
}
// Response
{
"result":[
{
"result":"success",
"cmd":"order/closeAll",
"index":13
}
]
}
POST https://api.bibox.com/v1/ctrade
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
leverage | true | integer | leverage | cross margin:0, fixed margin:1,2,... | |
cross | true | integer | cross flag | cross: 1, fixed: 0 |
POST request method:order/changeLeverage
The description of return result
{
"result":[
{
"result":"success",
"cmd":"order/changeLeverage",
"index":13
}
]
}
example
// Request
{
"cmd":"order/changeLeverage",
"body":{
"pair":"4BTC_USDT",
"leverage":40,
"cross": 0
},
"index":13
}
// Response
{
"result":[
{
"result":"success",
"cmd":"order/changeLeverage",
"index":13
}
]
}
POST https://api.bibox.com/v1/ctrade
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | string | Contract symbol | 4BTC_USDT,4ETH_USDT, ... | |
margin | true | integer | increase or reduce margin | increase: margin>=0.5; reduce: margin <=-0.5 |
POST request method:order/changeMargin
The description of return result
{
"result":[
{
"result":"success",
"cmd":"order/changeMargin"
}
]
}
example
// Request
{
"cmd":"order/changeMargin",
"body":{
"pair": "4ETH_USDT",
"margin": 4
},
"index":13
}
// Response
{
"result":[
{
"result":"success",
"cmd":"order/changeMargin",
"index":13
}
]
}
POST https://api.bibox.com/v1/ctrade
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
amount | true | integer | amount |
POST request method:transfer/in
The description of return result
{
"result":[
{
"result":"success",
"cmd":"transfer/in"
}
]
}
example
// Request
{
"cmd":"transfer/in",
"body":{
"amount":"100"
}
}
// Response
{
"result":[
{
"result":"success",
"cmd":"transfer/in"
}
]
}
GET https://api.bibox.com/v1/cquery?cmd=deals&&pair=?&&size=?
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | String | Contract symbol | 4BTC_USDT,4ETH_USDT,... | |
size | true | integer | return number | 1,2,... |
The description of return result
{
"result":{
"result":[
{
"pair":"4BTC_USDT", // contract symbol
"order_side":1, // 1long, 2short
"contract":52, // number of orders
"price":"3601.1600", // transaction price
"createdAt":1550977541000 // transaction time
},
...
],
"cmd":"deals/get",
"index":13
}
}
example
// Request
{
"cmd":"deals/get",
"body":{
"pair":"4BTC_USDT",
"size":10
},
"index":13
}
// Response
{
"result":
{
"result":[
{
"pair":"4BTC_USDT",
"order_side":1,
"contract":52,
"price":"3601.1600",
"createdAt":1550977541000
},
{
"pair":"4BTC_USDT",
"order_side":1,
"contract":26,
"price":"3601.1600",
"createdAt":1550977541000
},
...
],
"cmd":"deals/get",
"index":13
}
}
POST https://api.bibox.com/v1/cquery
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
ids | true | integer array | order id | limit 50 |
POST request method:query/orderPendingByIDs
The description of return result
{
"result":[
{
"result":[
{
"id":491168, // order id
"coin_symbol":"USDT",
"pair":"4ETH_USDT", // Contract symbol
"order_side":1, // 1long, 2short
"order_type":2,
"contract":3, // contract
"order_from":1,
"status":1, // 0,1:uncompleted; 2:partly completed; 3:completed; 4: partly cancel; 5 cancel completed; 6,7 system cancel;
"price":"136.0000", // order price
"price_deal":"0.0000", // average transaction price
"deal_count":0,
"contract_deal":0, // number of completed orders
"createdAt":"2019-02-20T02:01:46.000Z",
"updatedAt":"2019-02-20T02:01:46.000Z"
},
...
],
"cmd":"query/orderPendingByIDs",
"index":13
}
]
}
example
// Request
{
"cmd":"query/orderPendingByIDs",
"body":{
"ids":[
491168,
2
]
},
"index":13
}
// Response
{
"result":[
{
"result":[
{
"id":491168,
"coin_symbol":"USDT",
"pair":"4ETH_USDT",
"order_side":1,
"order_type":2,
"contract":3,
"order_from":1,
"status":1,
"price":"136.0000",
"price_deal":"0.0000",
"deal_count":0,
"contract_deal":0,
"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"
}
],
"cmd":"query/orderPendingByIDs",
"index":13
}
]
}
POST https://api.bibox.com/v1/cquery
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
pair | true | String | contract symbol | 1,2,... | |
size | true | integer | number | 1,2,... | |
begin_time | false | integer | starting time | ||
end_time | false | integer | ending time | ||
type | false | integer | transaction type | 1open position, 2liquidation, 3forced liquidation, 4cover position |
POST request method:query/orderList
The description of return result
{
"result":[
{
"result":{
"count":101,
"page":1,
"items":[
{
"id":236343,
"coin_symbol":"USDT",
"pair":"4BTC_USDT", // contract symbol
"type":2, // 1open position, 2liquidation, 3forced liquidation, 4cover position
"order_side":2, // 1long, 2short
"price_open":"3999.0000", // order pirce
"price":"3964.5800", // average price of opening position
"price_deal":"3999.0000", // transaction price
"contract":2, // number of Cont
"profit":"0.6884", // profits and losses
"fee":"0.0000", // transaction fee
"createdAt":"2019-02-23T17:07:31.000Z"
},
...
]
},
"cmd":"query/orderList"
}
]
}
example
// Request
{
"cmd":"query/orderList",
"body":{
"pair":"4BTC_USDT",
"page":1,
"size":100,
"begin_time":1550971541000,
"end_time":1550977541000,
type: 2,
}
}
// Response
{
"result":[
{
"result":{
"count":101,
"page":1,
"items":[
{
"id":236343,
"coin_symbol":"USDT",
"pair":"4BTC_USDT",
"type":2,
"order_side":2,
"price_open":"3999.0000",
"price":"3964.5800",
"price_deal":"3999.0000",
"contract":2,
"profit":"0.6884",
"fee":"0.0000",
"createdAt":"2019-02-23T17:07:31.000Z"
},
...
]
},
"cmd":"query/orderList"
}
]
}
POST https://api.bibox.com/v1/cquery
Request parameter
Parameter Name | Necessary or not | Type | Description | Default | Value Range |
---|---|---|---|---|---|
id | true | String | order id |
POST request method:query/orderDetailByID
Response
{
"result":[
{
"result":{
"items":[
{
"id":42, // order detail id
"coin_symbol":"USDT", //
"pair":"4BTC_USDT", // Contract symbol
"order_side":1, // 1 long, 2short
"contract":1, // contract
"order_from":1, // 1web,2android,3ios, 6 apikey,
"createdAt":"2019-08-13T08:22:25.000Z", // create time
"updatedAt":"2019-08-13T08:22:26.000Z",
"price":"7029.9700", // price
"price_deal":"0.0000", // deal price
"fee":"0.0000", // fee
"is_cancel":1, // 0 normal 1: canceld order
"is_maker":1, // 0: taker; 1: maker;
"order_type":2 // 1:market price 2:limited price
}
],
"count":9,
"page":1
},
"cmd":"query/orderDetailByID"
}
]
}
example
// Request
{
"cmd":"query/orderDetailByID",
"body":{
"id":"58", // order id
}
}
// Response
{
"result":[
{
"result":{
"items":[
{
"id":42, // order detail id
"coin_symbol":"USDT", //
"pair":"4BTC_USDT", // Contract symbol
"order_side":1, // 1 long, 2short
"contract":1, // contract
"order_from":1, // 1web,2android,3ios, 6 apikey,
"createdAt":"2019-08-13T08:22:25.000Z", // create time
"updatedAt":"2019-08-13T08:22:26.000Z",
"price":"7029.9700", // price
"price_deal":"0.0000", // deal price
"fee":"0.0000", // fee
"is_cancel":1, // 0 normal 1: canceld order
"is_maker":1, // 0: taker; 1: maker;
"order_type":2 // 1:market price 2:limited price
}
],
"count":9,
"page":1
},
"cmd":"query/orderDetailByID"
}
]
}
GET https://api.bibox.com/v1/cquery?cmd=contractValue
Request parameter: none
The description of return result
{
"result":{
"result":[
{
"pair":"4BTC_USDT",
"value":"0.0100000000",
"coin_symbol":"BTC"
},
],
"cmd":"contractValue"
}
}
example https://api.bibox.com/v1/cquery?cmd=contractValue
// Response
{
"result":[
{
"result":[
{
"pair":"4BTC_USDT", // contract symbol
"value":"0.0100000000", // contract value
"coin_symbol":"BTC"
},
...
],
"cmd":"query/contractValue",
"index":13
}
]
}
GET https://api.bibox.com/v1/cquery?cmd=contractConfig
Request parameter: none
The description of return result
{
"result":{
"result":{
"cross_leverage":25, // cross leverage
"leverage_max":50, // max leverage
"margin_rate_force":"0.01", // margin rate force
"night_fee_rate":"0.0006", // night fee rate
"hold_limit":{ // hold limit amount
"BTC":5000,
"ETH":150000,
"EOS":50000,
"LTC":35000,
"BCH":100000
}
},
"cmd":"contractConfig"
}
}
example https://api.bibox.com/v1/cquery?cmd=contractConfig
// Response
{
"result":{
"result":{
"cross_leverage":25, // default cross leverage
"leverage_max":50, // max leverage
"margin_rate_force":"0.01", // margin rate force
"night_fee_rate":"0.0006", // night fee rate
"hold_limit":{ // hold limit amount
"BTC":5000,
"ETH":150000,
"EOS":50000,
"LTC":35000,
"BCH":100000
}
},
"cmd":"contractConfig"
}
}
GET https://api.bibox.com/v1/cquery?cmd=openLimit
Request parameter: none
The description of return result
{
"result":{
"result":{
"BTC":5000,
"ETH":75000,
"EOS":75000,
"LTC":15000,
"BCH":15000
},
"cmd":"openLimit"
}
}
example https://api.bibox.com/v1/cquery?cmd=openLimit
// Response
{
"result":{
"result":{
"BTC":5000,
"ETH":75000,
"EOS":75000,
"LTC":15000,
"BCH":15000
},
"cmd":"openLimit"
}
}
Bibox Exchange provides REST API and WebSocket API, which are convenient for investors to view the market and trade easily.
- REST API Introduction
- Signature Authentication
- API Request and Response Format
- API Reference
- Error code
- Example