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

# 订单

> 现货 API：订单。

## 单笔获取

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

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| orderId | number | true | | 订单ID | |

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


}
```

```python Python theme={null}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "symbol": "BTC_USDT",                   //交易对
    "orderId": "6216559590087220004",       //订单号
    "clientOrderId": "16559590087220001",   //客户端订单号
    "baseCurrency": "string",               //标的币种
    "quoteCurrency": "string",              //报价币种
    "side": "BUY",                          //订单方向 BUY-买,SELL-卖
    "type": "LIMIT",                        //订单类型  LIMIT-限价,MARKET-市价 
    "timeInForce": "GTC",                   //有效方式  GTC,IOC,FOK,GTX
    "price": "40000",                       //价格
    "origQty": "2",                         //原始数量
    "origQuoteQty": "48000",                //原始金额
    "executedQty": "1.2",                   //已执行数量
    "leavingQty": "string",                 //待执行数量（若撤单或下单拒绝，该值为0）
    "tradeBase": "2",                       //成交标的(成交数量)
    "tradeQuote": "48000",                  //成交报价(成交金额)
    "avgPrice": "42350",                    //成交均价
    "fee": "string",                        //手续费
    "feeCurrency": "string",                //手续费币种
    "state": "NEW",                         //订单状态 NEW-新建,PARTIALLY_FILLED-部分成交,FILLED-全部成交,CANCELED-用户撤单,REJECTED-下单失败,EXPIRED-过期(time_in_force撤单或溢价撤单)
    "deductServices":[{                     //手续费抵扣列表（如果设置手续费抵扣并产生抵扣，使用该字段代表手续费，没有抵扣使用原有fee、feeCurrency字段代表手续费）                         
                          "fee":"0.1",     
                          "feeCurrency":"mcr"
                      },
                      {   
                          "fee":"0.001",
                          "feeCurrency":"btc"
                      }],
    "time": 1655958915583,                  //订单时间
    "ip": "127.0.0.1",                      //ip地址
    "updatedTime": 1655958915583            //订单更新时间
  }
}
```

## 单笔查询

`GET` `/v4/order`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| orderId | number | false | | 订单ID | |
| clientOrderId | string | false | | 客户端订单号 | |

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


}
```

```python Python theme={null}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "symbol": "BTC_USDT",                   //交易对
    "orderId": "6216559590087220004",       //订单号
    "clientOrderId": "16559590087220001",   //客户端订单号
    "baseCurrency": "string",               //标的币种
    "quoteCurrency": "string",              //报价币种
    "side": "BUY",                          //订单方向 BUY-买,SELL-卖
    "type": "LIMIT",                        //订单类型  LIMIT-限价,MARKET-市价 
    "timeInForce": "GTC",                   //有效方式  GTC,IOC,FOK,GTX
    "price": "40000",                       //价格
    "origQty": "2",                         //原始数量
    "origQuoteQty": "48000",                //原始金额
    "executedQty": "1.2",                   //已执行数量
    "leavingQty": "string",                 //待执行数量（若撤单或下单拒绝，该值为0）
    "tradeBase": "2",                       //成交标的(成交数量)
    "tradeQuote": "48000",                  //成交报价(成交金额)
    "avgPrice": "42350",                    //成交均价
    "fee": "string",                        //手续费
    "feeCurrency": "string",                //手续费币种
    "state": "NEW",                         //订单状态 NEW-新建,PARTIALLY_FILLED-部分成交,FILLED-全部成交,CANCELED-用户撤单,REJECTED-下单失败,EXPIRED-过期(time_in_force撤单或溢价撤单)
    "deductServices":[{                     //手续费抵扣列表（如果设置手续费抵扣并产生抵扣，使用该字段代表手续费，没有抵扣使用原有fee、feeCurrency字段代表手续费）
                          "fee":"0.1",     
                          "feeCurrency":"mcr"
                      },
                      {   
                          "fee":"0.001",
                          "feeCurrency":"btc"
                      }],
    "time": 1655958915583,                  //订单时间
    "updatedTime": 1655958915583            //订单更新时间
  }
}
```

## 单笔下单

`POST` `/v4/order`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | true | | 交易对 | |
| clientOrderId | string | false | | 客户端ID正则：^\[a-zA-Z0-9\_]\{4,32}\$ | |
| side | string | true | | 买卖方向  BUY-买,SELL-卖 | |
| type | string | true | | 订单类型  LIMIT-限价,MARKET-市价 | |
| timeInForce | string | true | | 有效方式 GTC, FOK, IOC, GTX | |
| bizType | string | true | | 业务类型  SPOT-现货, LEVER-杠杆 | |
| price | number | false | | 价格。限价必填; 市价不填 | |
| quantity | number | false | | 数量。限价必填；市价按数量下单时必填 | |
| quoteQty | number | false | | 金额。限价不填；市价按金额下单时必填 | |
| nftId | string | false | | nft id | |

### 备注

按照市价创建BUY订单时，quantity为空，quoteQty必填；按照市价创建SELL订单时，quoteQty为空，quantity必填。

### 限流规则

20/s/apikey

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


}
```

```python Python theme={null}
```

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

## 单笔撤单

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

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| orderId | number | true | | 订单ID | |

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


}
```

```python Python theme={null}
```

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

## 批量获取

`GET` `/v4/batch-order`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| orderIds | string | true | | 订单ID集合，逗号分割 eg:  6216559590087220004,6216559590087220004 | |

reponse 字段信息参考单笔订单获取接口

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


}
```

```python Python theme={null}
```

```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、feeCurrency字段代表手续费）
                            "fee":"0.1",     
                            "feeCurrency":"mcr"
                        },
                        {   
                            "fee":"0.001",
                            "feeCurrency":"btc"
                        }],
      "time": 1655958915583,
      "ip": "127.0.0.1",
      "updatedTime": 1655958915583
    }
  ]
}
```

## 批量下单

`POST` `/v4/batch-order`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| clientBatchId | string | false | | 客户端批次号，正则：^\[a-zA-Z0-9\_]\{4,32}\$ | |
| items | array | true | | 集合 | |
| item.symbol | string | true | | 交易对 | |
| item.clientOrderId | string | false | | 客户端ID，正则：^\[a-zA-Z0-9\_]\{4,32}\$ | |
| item.side | string | true | | 订单方向 BUY-买,SELL-卖 | |
| item.type | string | true | | 订单类型  LIMIT-限价,MARKET-市价 | |
| item.timeInForce | string | true | | 有效方式  GTC,IOC,FOK,GTX | |
| item.bizType | string | true | | 业务类型  SPOT-现货, LEVER-杠杆 | |
| item.price | number | false | | 价格。现价必填; 市价不填 | |
| item.quantity | number | false | | 数量。现价必填；市价按数量下单时必填 | |
| item.quoteQty | number | false | | 金额。现价不填；市价按金额下单时必填 | |

### 限流规则

30/s/apikey

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


}
```

```python Python theme={null}
```

```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",                       // 下标，从0开始 
        "clientOrderId": "123",             // 客户端订单ID 
        "orderId": "123",                   // 订单ID 
        "reject": "false",                  // 是否拒单 
        "reason": "invalid price precision" // 拒单原因 
      }
    ]
  }
}
```

## 单笔改单（限价）

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

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| orderId | number | true | | 订单号 | |
| price | number | true | | 价格 | |
| quantity | number | true | | 数量 | |

### 限流规则

50/s/apikey

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


}
```

```python Python theme={null}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "orderId": "6216559590087220004",   //订单ID
    "modifyId": "407329711723834560"    //修改ID
  }
}
```

## 批量撤单

`DELETE` `/v4/batch-order`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| clientBatchId | string | false | | 客户端批次号 | |
| orderIds | array | true | | 集合\[6216559590087220004,6216559590087220005] | |

注意：参数以json形式放在body中

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


}
```

```python Python theme={null}
```

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

## 查询当前挂单

`GET` `/v4/open-order`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | false | | 交易对，不传代表所有 | |
| bizType | string | false | | 业务类型  SPOT-现货, LEVER-杠杆 | |
| side | string | false | | BUY-买,SELL-卖 | |

### 限流规则

10/s/apikey

```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、feeCurrency字段代表手续费）
                            "fee":"0.1",     
                            "feeCurrency":"mcr"
                        },
                        {   
                            "fee":"0.001",
                            "feeCurrency":"btc"
                        }],
      "time": 1655958915583,
      "ip": "127.0.0.1",
      "updatedTime": 1655958915583
    }
  ]
}
```

## 撤销当前挂单

`DELETE` `/v4/open-order`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | false | | 交易对，不传代表所有 | |
| bizType | string | true | | 业务类型  SPOT-现货, LEVER-杠杆 | |
| side | string | false | | BUY-买,SELL-卖 | |

### 限流规则

10/s/apikey\
注意：参数以json形式放在body中

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

## 历史订单查询

`GET` `/v4/history-order`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | false | | 交易对，不传代表所有 | |
| bizType | string | false | | 业务类型  SPOT-现货, LEVER-杠杆 | |
| side | string | false | | BUY-买,SELL-卖 | |
| type | string | false | | 订单类型   LIMIT-限价, MARKET-市价 | |
| state | string | false | | 订单状态 NEW-新建,PARTIALLY\_FILLED-部分成交,FILLED-全部成交,CANCELED-用户撤单,REJECTED-下单失败,EXPIRED-过期(time\_in\_force撤单或溢价撤单) | |
| fromId | number | false | | 起始ID | |
| direction | string | false | | 查询方向:PREV, NEXT | |
| limit | number | false | 20 | 限制数量,最大100 | |
| startTime | number | false | | 开始时间 eg:1657682804112 | |
| endTime | number | false | | 结束时间 | |
| hiddenCanceled | bool | false | | 隐藏已取消 | |

### 限流规则

10/s/apikey

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": {
    "hasPrev": true,
    "hasNext": true,
    "items": [   //内容信息参考单笔获取订单接口
      {
        "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、feeCurrency字段代表手续费）
                              "fee":"0.1",     
                              "feeCurrency":"mcr"
                          },
                          {   
                              "fee":"0.001",
                              "feeCurrency":"btc"
                          }],
        "time": 1655958915583,
        "ip": "127.0.0.1",
        "updatedTime": 1655958915583
      }
    ]
  }
}
```

## 成交查询

`GET` `/v4/trade`

**Parameters**

| 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 |
| - | - | - | - | - | - |
| symbol | string | false | | 交易对，不传代表所有 | |
| bizType | string | false | | 业务类型  SPOT-现货, LEVER-杠杆 | |
| orderSide | string | false | | BUY-买,SELL-卖 | |
| orderType | string | false | | 订单类型   LIMIT-限价, MARKET-市价 | |
| orderId | number | false | | 订单号 | |
| fromId | number | false | | 分页起始ID | |
| direction | string | false | | 查询方向:PREV, NEXT | |
| limit | number | false | 20 | 限制数量,最大100 | |
| startTime | number | false | | 开始时间 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",                //成交金额
        "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.