Batch Order
Batch order
(Authentication type: SIGNED, See Interface Permission)
Request Format
POST https://api-cloud.bitmart.com/contract/v1/ifcontract/batchOrders
Request Limit
Request Parameter
Opening order request
Field | Type | Required? | Description |
---|---|---|---|
contract_id | long | Yes | Contract ID |
category | int | Yes | Order type |
1 : Limit order |
|||
2 : Market order |
|||
way | int | Yes | Order side |
1 : Open long |
|||
4 : Open short |
|||
custom_id | int | Yes | The client's custom ID must be passed, otherwise it returns invalid parameters |
open_type | int | Yes | Open type |
1 : Cross margin |
|||
2 : Fixed margin |
|||
leverage | int | Yes | Leverage must meet the effective range of leverage configured in the contract, otherwise invalid parameters are returned |
price | string | Yes | The price must meet the price accuracy requirements of the contract configuration, and the accuracy is the contract configuration price precision multiplied by 10, otherwise invalid request is returned |
vol | string | Yes | The quantity must meet the quantity precision configured by the contract, otherwise invalid request is returned |
Closing order request
Field | Type | Required? | Description |
---|---|---|---|
contract_id | long | Yes | Contract ID |
category | int | Yes | Order type |
1 : Limit order |
|||
2 : Market order |
|||
position_id | long | Yes | Position ID, you must send the position ID, otherwise invalid parameters are returned |
way | int | Yes | Order side |
2 : Close short |
|||
3 : Close long |
|||
price | string | Yes | The price must meet the price accuracy requirements of the contract configuration, and the accuracy is the contract configuration price precision multiplied by 10, otherwise invalid request is returned |
vol | string | Yes | The quantity must meet the quantity precision configured by the contract, otherwise invalid request is returned |
Instruction
Request example
https://api-cloud.bitmart.com/contract/v1/ifcontract/batchOrders
{
"orders":[
{
"contract_id":3,
"category":1,
"custom_id":1,
"way":4,
"open_type":1,
"leverage":100,
"price":"100",
"vol":"10"
},
{
"contract_id":3,
"category":1,
"custom_id":2,
"way":4,
"open_type":1,
"leverage":100,
"price":"100",
"vol":"10"
}
]
}
Response Data
Field | Type | Description |
---|---|---|
custom_id | int | Client custom ID |
order_id | int | Order ID |
Example of returned data format
Success:
{
"code": 1000,
"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1",
"message": "OK",
"data": {
"orders": [
{
"custom_id": 1,
"order_id": 10540013
},
{
"custom_id": 2,
"order_id": 10540014
}
]
}
}
Failure:
{
"errno": "OK",
"message": "Success",
"data": {
"orders": [
{
"custom_id": 1,
"err": {
"http_err":405,
"err_code":"LIQUIDATE_ORDER",
"err_msg":"The order will trigger a strong flat"
}
},
{
"custom_id": 2,
"order_id": 10540014
}
]
}
}