Submit Order
Submit order
(Authentication type: SIGNED, See Interface Permission)
Request Format
POST https://api-cloud.bitmart.com/contract/v1/ifcontract/submitOrder
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 |
Instruction
Note: If vol is too small, it may cause the system to cancel automatically due to the lack of cost freeze when opening short.
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 |
|||
custom_id | int | Yes | Client's custom ID must be passed, otherwise it returns invalid parameters |
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
Note: open_type cannot be passed for closing orders, otherwise invalid parameters are returned
Request example
https://api-cloud.bitmart.com/contract/v1/ifcontract/submitOrder
The body of the opening order request
{
"contract_id":1,
"category":1,
"way":4,
"custom_id": 100,
"open_type":1,
"leverage":10,
"price":"16",
"vol":"10"
}
The body of the closing order request
{
"contract_id":1,
"category":1,
"position_id":12121,
"custom_id": 100,
"way":3,
"price":"16",
"vol":"10"
}
Response Data
Field | Type | Description |
---|---|---|
order_id | int | Order ID |
Instruction
The order_id will only be returned if the request is successful.
Example of returned data format
{
"code": 1000,
"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1",
"message": "OK",
"data": {
"order_id": 2707217580
}
}