> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monochrome.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# Orders

> Futures API: orders.

## Create Orders

`POST` `/future/trade/v1/order/create`

Content-Type = application/x-www-form-urlencoded && application/json

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| clientOrderId | string | false | N/A | Client order ID | |
| symbol | string | true | | Trading pair | |
| orderSide | string | true | N/A | Order side:BUY;SELL | BUY;SELL |
| orderType | string | true | N/A | Order type:LIMIT；MARKET | LIMIT；MARKET |
| origQty | number | true | N/A | Quantity (Cont) | |
| price | number | false | N/A | Price | |
| timeInForce | string | false | GTC | Valid way:GTC;IOC;FOK;GTX | GTC;IOC;FOK;GTX |
| triggerProfitPrice | number | false | N/A | Stop profit price | |
| triggerStopPrice | number | false | N/A | Stop loss price | |
| positionSide | string | true | N/A | Position side:LONG;SHORT | LONG;SHORT |

### OrigQty Calculation Formula

**Formula**

origQty = Truncate ((Balance \* Percent \* Leverage ) / (Mark\_price \* Contract\_size))

**Explain**

```text theme={null}
Truncate : take the integer part 

Balance : (walletBalance - openOrderMarginFrozen) , api: /future/user/v1/compat/balance/list  

Percent : user input , exp: 0.2 

Leverage : leverage your want , exp: 20 

Mark_price : current symobl mark price , exp: 88888 (btc_usdt) 

Contract_size : contractSize , api: /future/market/v1/public/symbol/detail , Contract multiplier(face value)  
```

**Example**

truncate(10000 \* 0.2 \* 20 / 88888 / 0.0001) = 4500

### Limit Flow Rules

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {},
  "returnCode": 0
}
```

## See Order History

`GET` `/future/trade/v1/order/list-history`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | true | N/A | Trading pairs (queries all trading pairs if not passed) | |
| direction | string | false | NEXT | Direction（PREV:Previous page；NEXT:Next page） | PREV;NEXT |
| id | integer | false | N/A | id | |
| limit | integer | false | 10 | Limit | |
| startTime | integer | false | N/A | Start time | |
| endTime | integer | false | N/A | End time | |

### Limit Flow Rules

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {
    "hasNext": false, //Is there a next page
    "hasPrev": false, //Is there a previous page
    "items": [ //Datasheets
      {
        "clientOrderId": "", //Client order ID
        "avgPrice": 0, //Average price
        "closePosition": false, //Whether to close all when order condition is triggered
        "closeProfit": 0, //Offset profit and loss
        "createdTime": 0, //Creat time
        "executedQty": 0, //Volume (Cont)
        "forceClose": false, //Is it a liquidation order
        "marginFrozen": 0, //Occupied margin
        "orderId": 0, //Order ID
        "orderSide": "", //Order side
        "orderType": "", //Order type
        "origQty": 0, //Quantity (Cont)
        "positionSide": "", //Position side
        "price": 0, //Order price
        "sourceId": 0, //Triggering conditions ID
        "state": "", //Order state:NEW：New order (unfilled);PARTIALLY_FILLED:Partial deal;PARTIALLY_CANCELED:Partial revocation;FILLED:Filled;CANCELED:Cancled;REJECTED:Order failed;EXPIRED：Expired
        "symbol": "", //Trading pair
        "timeInForce": "", //Valid type
        "triggerProfitPrice": 0, //TP trigger price
        "triggerStopPrice": 0 //SL trigger price
      }
    ]
  },
  "returnCode": 0
}
```

## See Transaction Details

`GET` `/future/trade/v1/order/trade-list`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderId | integer | false | N/A | Order ID | |
| symbol | string | false | N/A | Trading pair | |
| page | integer | false | 1 | Page | |
| size | integer | false | 10 | Quantity of a single page | |
| startTime | integer | false | N/A | start time | |
| endTime | integer | false | N/A | end time | |

### Limit Flow Rules

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {
    "items": [
      {
        "fee": 0,                //Fee
        "feeCoin": "",           //Currency of fee
        "orderId": 0,            //Order ID
        "execId": 0,             //Trade ID
        "price": 0,              //Price
        "quantity": 0,           //Volume
        "symbol": "",            //Trading pair
        "timestamp": 0,          //Time
        "takerMaker": "TAKER"    //taker or maker
      }
    ],
    "page": 0,
    "ps": 0,
    "total": 0
  },
  "returnCode": 0
}
```

## Update Orders

`POST` `/future/trade/v1/order/update`

Content-Type = application/x-www-form-urlencoded && application/json

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderId | number | true | | Order ID | |
| price | number | true | | Target price | |
| origQty | number | true | | Target quantity (cont) | |
| triggerProfitPrice | number | false | N/A | Profit target price | |
| triggerStopPrice | number | false | N/A | Stop-Loss price | |
| triggerPriceType | string | false | LATEST\_PRICE | Trigger price type | INDEX\_PRICE(Index price)；MARK\_PRICE(Mark price)；LATEST\_PRICE(latest price) |
| profitDelegateOrderType | string | false | N/A | Take-Profit order type | LIMIT；MARKET |
| profitDelegateTimeInForce | string | false | N/A | Take-Profit order validity method | GTC;IOC;FOK;GTX |
| profitDelegatePrice | number | false | N/A | Take-Profit order price | |
| stopDelegateOrderType | string | false | N/A | Stop-Loss order type | LIMIT；MARKET |
| stopDelegateTimeInForce | string | false | N/A | Stop-Loss order validity method | GTC;IOC;FOK;GTX |
| stopDelegatePrice | number | false | N/A | Stop-Loss order price | |
| followUpOrder | boolean | false | N/A | | If true, it indicates chase order |

### Limit Flow Rules

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {},
  "returnCode": 0
}
```

## Bulk Orders

`POST` `/future/trade/v2/order/create-batch`

Content-Type = application/x-www-form-urlencoded && application/json

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| list | string | true | N/A | List collection of order data | |

### Limit Flow Rules

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": true,
  "returnCode": 0
}
```

## See Orders by ID

`GET` `/future/trade/v1/order/detail`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderId | integer | true | N/A | Order ID | |

### Limit Flow Rules

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {
    "avgPrice": 0, //Average price
    "closePosition": false, //Whether to close all when order condition is triggered
    "closeProfit": 0, //Offset profit and loss
    "createdTime": 0, //Create time
    "executedQty": 0, //Volume (Cont)
    "forceClose": false, //Is it a liquidation order
    "marginFrozen": 0, //Occupied margin
    "orderId": 0, //Order ID
    "orderSide": "", //Order side
    "orderType": "", //Order type
    "origQty": 0, //Quantity (Cont)
    "positionSide": "", //Position side
    "price": 0, //Order price
    "sourceId": 0, //Triggering conditions ID
    "state": "", //Order state:NEW：New order (unfilled);PARTIALLY_FILLED:Partial deal;PARTIALLY_CANCELED:Partial revocation;FILLED:Filled;CANCELED:Cancled;REJECTED:Order failed;EXPIRED：Expired
    "symbol": "", //Trading pair
    "timeInForce": "", //Valid type
    "triggerProfitPrice": 0, //TP trigger price
    "triggerStopPrice": 0 //SL trigger price
  },
  "returnCode": 0
}
```

## See Orders

`GET` `/future/trade/v1/order/list`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| clientOrderId | String | false | N/A | Client order ID | |
| page | integer | false | 1 | Page | |
| size | integer | false | 10 | Quantity of a single page | |
| startTime | integer | false | N/A | Start time | |
| endTime | integer | false | N/A | End time | |
| state | string | false | NEW | Order state: NEW：New order (unfilled);PARTIALLY\_FILLED:Partial deal;PARTIALLY\_CANCELED:Partial revocation;FILLED:Filled;CANCELED:Cancled;REJECTED:Order failed;EXPIRED：Expired;UNFINISHED:Unfinished;HISTORY:(History) | |
| symbol | string | false | N/A | Trading pair | |

### Limit Flow Rules

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": {
    "items": [
      {
        "clientOrderId": "", //Client order ID
        "avgPrice": 0, //Average price
        "closePosition": false, //Whether to close all when order condition is triggered
        "closeProfit": 0, //Offset profit and loss
        "createdTime": 0, //Creat time
        "executedQty": 0, //Volume (Cont)
        "forceClose": false, //Is it a liquidation order
        "marginFrozen": 0, //Occupied margin
        "orderId": 0, //Order id
        "orderSide": "", //Order side
        "orderType": "", //Order type
        "origQty": 0, //Quantity (Cont)
        "positionSide": "", //Position side
        "price": 0, //Order price
        "sourceId": 0, //Triggering conditions ID
        "state": "", //Order state:NEW：New order (unfilled);PARTIALLY_FILLED:Partial deal;PARTIALLY_CANCELED:Partial revocation;FILLED:Filled;CANCELED:Cancled;REJECTED:Order failed;EXPIRED：Expired
        "symbol": "", //Trading pair
        "timeInForce": "", //Valid type
        "triggerProfitPrice": 0, //TP trigger price
        "triggerStopPrice": 0 //SL trigger price
      }
    ],
    "page": 0,
    "ps": 0,
    "total": 0
  },
  "returnCode": 0
}
```

## Cancel Orders

`POST` `/future/trade/v1/order/cancel`

Content-Type = application/x-www-form-urlencoded && application/json

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderId | Integer | true | N/A | Order ID | |

### Limit Flow Rules

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": "", //Order ID
  "returnCode": 0
}
```

## Cancel All Orders

`POST` `/future/trade/v1/order/cancel-all`

Content-Type = application/x-www-form-urlencoded && application/json

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | String | true | N/A | Trading pair (cancel all trading pair orders if pass "") | |

### Limit Flow Rules

200/s/apikey

```json Response theme={null}
{
  "error": {
    "code": "",
    "msg": ""
  },
  "msgInfo": "",
  "result": true,
  "returnCode": 0
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.