> ## 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

> Spot API: orders.

## Get single

`GET` `/v4/order/{orderId}`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderId | number | true | | | |

```java Java theme={null}
public String orderGet(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "symbol": "BTC_USDT",   
    "orderId": "6216559590087220004",  
    "clientOrderId": "16559590087220001",  
    "baseCurrency": "string",   
    "quoteCurrency": "string",   
    "side": "BUY",                          //order side:BUY,SELL
    "type": "LIMIT",                        //order type  LIMIT,MARKET 
    "timeInForce": "GTC",                   //effective way:GTC,IOC,FOK,GTX
    "price": "40000",   
    "origQty": "2",                         //original quantity
    "origQuoteQty": "48000",                //original amount
    "executedQty": "1.2",                   //executed quantity
    "leavingQty": "string",                 //The quantity to be executed (if the order is cancelled or the order is rejected, the value is 0)
    "tradeBase": "2",                       //transaction quantity
    "tradeQuote": "48000",                  //transaction amount
    "avgPrice": "42350",                    //average transaction price
    "fee": "string",                        //handling fee
    "feeCurrency": "string",   
    "state": "NEW",                         //order stat NEW,PARTIALLY_FILLED,FILLED,CANCELED,REJECTED,EXPIRED
    "deductServices":[{                     //Fee deduction list (if set Monochrome deduction fee and the deduction occurs, use this field to represent the trade fee. Otherwise, use the original fee and feeCurrency fields to represent the trade fee). 
                          "fee":"0.1",     
                          "feeCurrency":"mcr"
                      },
                      {   
                          "fee":"0.001",
                          "feeCurrency":"btc"
                      }],
    "time": 1655958915583,                  //order time
    "ip": "127.0.0.1",                      //ip address
    "updatedTime": 1655958915583  
  }
}
```

## Query single

`GET` `/v4/order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderId | number | false | | | |
| clientOrderId | string | false | | | |

```java Java theme={null}
public String orderGet(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "symbol": "BTC_USDT",   
    "orderId": "6216559590087220004",  
    "clientOrderId": "16559590087220001",  
    "baseCurrency": "string",   
    "quoteCurrency": "string",   
    "side": "BUY",                      //order side:BUY,SELL
    "type": "LIMIT",                    //order type  LIMIT,MARKET 
    "timeInForce": "GTC",               //effective way:GTC,IOC,FOK,GTX
    "price": "40000",   
    "origQty": "2",                     //original quantity
    "origQuoteQty": "48000",            //original amount
    "executedQty": "1.2",               //executed quantity
    "leavingQty": "string",             //The quantity to be executed (if the order is cancelled or the order is rejected, the value is 0)
    "tradeBase": "2",                   //transaction quantity
    "tradeQuote": "48000",              //transaction amount
    "avgPrice": "42350",                //average transaction price
    "fee": "string",                    //handling fee
    "feeCurrency": "string",   
    "state": "NEW",                     //order stat NEW,PARTIALLY_FILLED,FILLED,CANCELED,REJECTED,EXPIRED
    "deductServices":[{                 //Fee deduction list (if set Monochrome deduction fee and the deduction occurs, use this field to represent the trade fee. Otherwise, use the original fee and feeCurrency fields to represent the trade fee).  
                          "fee":"0.1",     
                          "feeCurrency":"mcr"
                      },
                      {   
                          "fee":"0.001",
                          "feeCurrency":"btc"
                      }],
    "time": 1655958915583,              //order time
    "updatedTime": 1655958915583  
  }
}
```

## Submit order

`POST` `/v4/order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | true | | | |
| clientOrderId | string | false | | Pattern: ^\[a-zA-Z0-9\_]\{4,32}\$ | |
| side | string | true | | BUY,SELL | |
| type | string | true | | order type:LIMIT,MARKET | |
| timeInForce | string | true | | effective way:GTC, FOK, IOC, GTX | |
| bizType | string | true | | SPOT, LEVER | |
| price | number | false | | price. Required if it is the LIMIT price; blank if it is the MARKET price | |
| quantity | number | false | | quantity. Required if it is the LIMIT price or the order is placed at the market price by quantity | |
| quoteQty | number | false | | amount. Required if it is the LIMIT price or the order is the market price when placing an order by amount | |
| nftId | string | false | | nft id | |

### Remark

Create a BUY order based on market price, quantity must be null, quoteQty required; Create a SELL order based on market price, quoteQty must be null, quantity required.

### Limit Flow Rules

20/s/apikey

```java Java theme={null}
public String orderPost(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "orderId": "6216559590087220004",
    "ip": "127.0.0.1",                  // ip address
  }
}
```

## Cancell order

`DELETE` `/v4/order/{orderId}`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderId | number | true | | | |

```java Java theme={null}
public String orderDel(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "cancelId": "6216559590087220004"
  }
}
```

## Get batch

`GET` `/v4/batch-order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderIds | string | true | | order Ids eg: 6216559590087220004, 6216559590087220004 | |

reponse field information, refer to the Get single interface

```java Java theme={null}
public String batchOrderGet(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": [
    {
      "symbol": "BTC_USDT",
      "orderId": "6216559590087220004",
      "clientOrderId": "16559590087220001",
      "baseCurrency": "string",
      "quoteCurrency": "string",
      "side": "BUY",
      "type": "LIMIT",
      "timeInForce": "GTC",
      "price": "40000",
      "origQty": "2",
      "origQuoteQty": "48000",
      "executedQty": "1.2",
      "leavingQty": "string",
      "tradeBase": "2",
      "tradeQuote": "48000",
      "avgPrice": "42350",
      "fee": "string",
      "feeCurrency": "string",
      "state": "NEW",
      "deductServices":[{   //Fee deduction list (if set Monochrome deduction fee and the deduction occurs, use this field to represent the trade fee. Otherwise, use the original fee and feeCurrency fields to represent the trade fee). 
                            "fee":"0.1",     
                            "feeCurrency":"mcr"
                        },
                        {   
                            "fee":"0.001",
                            "feeCurrency":"btc"
                        }],
      "time": 1655958915583,
      "ip": "127.0.0.1",
      "updatedTime": 1655958915583
    }
  ]
}
```

## Submit batch order

`POST` `/v4/batch-order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| clientBatchId | string | false | | Client batch number. Pattern: ^\[a-zA-Z0-9\_]\{4,32}\$ | |
| items | array | true | | array | |
| item.symbol | string | true | | | |
| item.clientOrderId | string | false | | Pattern: ^\[a-zA-Z0-9\_]\{4,32}\$ | |
| item.side | string | true | | BUY,SELL | |
| item.type | string | true | | order type:LIMIT,MARKET | |
| item.timeInForce | string | true | | effective way:GTC, FOK, IOC, GTX | |
| item.bizType | string | true | | SPOT, LEVER | |
| item.price | number | false | | price. Required if it is the LIMIT price; blank if it is the MARKET price | |
| item.quantity | number | false | | quantity. Required if it is the LIMIT price or the order is placed at the market price by quantity | |
| item.quoteQty | number | false | | amount. Required if it is the LIMIT price or the order is the market price when placing an order by amount | |

### Limit Flow Rules

30/s/apikey

```java Java theme={null}
public String batchOrderPost(){


}
```

```json Request theme={null}
{
  "clientBatchId": "51232",
  "items": [
    {
      "symbol": "BTC_USDT",
      "clientOrderId": "16559590087220001",
      "side": "BUY",
      "type": "LIMIT",
      "timeInForce": "GTC",
      "bizType": "SPOT",
      "price": 40000,
      "quantity": 2,
      "quoteQty": 80000
    }
  ]
}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "batchId": "123", 
    "items": [   
      {
        "index": "0", // start with 0 
        "clientOrderId": "123", 
        "orderId": "123", 
        "reject": "false", 
        "reason": "invalid price precision" 
      }
    ]
  }
}
```

## Update Order(Limit)

`PUT` `/v4/order/{orderId}`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| orderId | number | true | | order ID | |
| price | number | true | | Price | |
| quantity | number | true | | Quantity | |

### Limit Flow Rules

50/s/apikey

```java Java theme={null}
public String orderPost(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "orderId": "6216559590087220004",   //order id
    "modifyId": "407329711723834560"    //modify id
  }
}
```

## Cancell batch order

`DELETE` `/v4/batch-order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| clientBatchId | string | false | | client batch id | |
| orderIds | array | true | | 6216559590087220004, 6216559590087220005 | |

Note: The parameters should be placed in the request body in the form of json

```java Java theme={null}
public String batchOrderDel(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {}
}
```

## Query the current pending order

`GET` `/v4/open-order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | Trading pair, if not filled in, represents all | |
| bizType | string | false | | SPOT, LEVER | |
| side | string | false | | BUY,SELL | |

### Limit Flow Rules

10/s/apikey

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": [      //For field information, refer to the Get single interface
    {
      "symbol": "BTC_USDT",
      "orderId": "6216559590087220004",
      "clientOrderId": "16559590087220001",
      "baseCurrency": "string",
      "quoteCurrency": "string",
      "side": "BUY",
      "type": "LIMIT",
      "timeInForce": "GTC",
      "price": "40000",
      "origQty": "2",
      "origQuoteQty": "48000",
      "executedQty": "1.2",
      "leavingQty": "string",
      "tradeBase": "2",
      "tradeQuote": "48000",
      "avgPrice": "42350",
      "fee": "string",
      "feeCurrency": "string",
      "state": "NEW",
      "deductServices":[{   //Fee deduction list (if set Monochrome deduction fee and the deduction occurs, use this field to represent the trade fee. Otherwise, use the original fee and feeCurrency fields to represent the trade fee). 
                            "fee":"0.1",     
                            "feeCurrency":"mcr"
                        },
                        {   
                            "fee":"0.001",
                            "feeCurrency":"btc"
                        }],
      "time": 1655958915583,
      "ip": "127.0.0.1",
      "updatedTime": 1655958915583
    }
  ]
}
```

## Cancel the current pending order

`DELETE` `/v4/open-order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | Trading pair, if not filled in, represents all | |
| bizType | string | true | | SPOT, LEVER | |
| side | string | false | | BUY,SELL | |

### Limit Flow Rules

10/s/apikey Note: The parameters should be placed in the request body in the form of json

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {}
}
```

## Query historical orders

`GET` `/v4/history-order`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | Trading pair, if not filled in, represents all | |
| bizType | string | false | | SPOT, LEVER | |
| side | string | false | | BUY,SELL | |
| type | string | false | | LIMIT, MARKET | |
| state | string | false | | order [state](#orderStatus), PARTIALLY\_FILLED, FILLED, CANCELED, REJECTED,EXPIRED | |
| fromId | number | false | | start id | |
| direction | string | false | | query direction:PREV, NEXT | |
| limit | number | false | 20 | Limit number, max 100 | |
| startTime | number | false | | eg:1657682804112 | |
| endTime | number | false | | | |
| hiddenCanceled | bool | false | | | |

### Limit Flow Rules

10/s/apikey

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "hasPrev": true,
    "hasNext": true,
    "items": [   //For field information, refer to the Get single interface
      {
        "symbol": "BTC_USDT",
        "orderId": "6216559590087220004",
        "clientOrderId": "16559590087220001",
        "baseCurrency": "string",
        "quoteCurrency": "string",
        "side": "BUY",
        "type": "LIMIT",
        "timeInForce": "GTC",
        "price": "40000",
        "origQty": "2",
        "origQuoteQty": "48000",
        "executedQty": "1.2",
        "leavingQty": "string",
        "tradeBase": "2",
        "tradeQuote": "48000",
        "avgPrice": "42350",
        "fee": "string",
        "feeCurrency": "string",
        "state": "NEW",
        "deductServices":[{   //Fee deduction list (if set Monochrome deduction fee and the deduction occurs, use this field to represent the trade fee. Otherwise, use the original fee and feeCurrency fields to represent the trade fee). 
                              "fee":"0.1",     
                              "feeCurrency":"mcr"
                          },
                          {   
                              "fee":"0.001",
                              "feeCurrency":"btc"
                          }],
        "time": 1655958915583,
        "ip": "127.0.0.1",
        "updatedTime": 1655958915583
      }
    ]
  }
}
```

## Query trade

`GET` `/v4/trade`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | Trading pair, if not filled in, represents all | |
| bizType | string | false | | SPOT, LEVER | |
| orderSide | string | false | | BUY,SELL | |
| orderType | string | false | | LIMIT, MARKET | |
| orderId | number | false | | | |
| fromId | number | false | | start id | |
| direction | string | false | | query direction:PREV, NEXT | |
| limit | number | false | 20 | Limit number, max 100 | |
| startTime | number | false | | start time eg:1657682804112 | |
| endTime | number | false | | | |

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "hasPrev": true,
    "hasNext": true,
    "items": [
      {
        "symbol": "BTC_USDT",  
        "tradeId": "6316559590087222001",  
        "orderId": "6216559590087220004",  
        "orderSide": "BUY",    
        "orderType": "LIMIT",  
        "bizType": "SPOT",    
        "time": 1655958915583,  
        "price": "40000",     
        "quantity": "1.2",    
        "quoteQty": "48000",   //amount
        "baseCurrency": "BTC",  
        "quoteCurrency": "USDT",  
        "fee": "0.5",   
        "feeCurrency": "USDT", 
        "takerMaker": "taker"  //takerMaker
      }
    ]
  }
}
```


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