> For the complete documentation index, see [llms.txt](https://weex-1.gitbook.io/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://weex-1.gitbook.io/en/futures-1/restapi/contract-trades-endpoints.md).

# Contract Trades Endpoints

### New Order <a href="#fd6ce2a756" id="fd6ce2a756"></a>

Rate Limit：10 requests per second

**HTTP Requests** new order

* POST /api/swap/v3/order/placeOrder

**Request Parameter**

| Parameters            | Type       | Required | Description                                                                                                                                                                                                            |
| --------------------- | ---------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| symbol                | String     | Yes      | Contract name                                                                                                                                                                                                          |
| client\_oid           | String     | Yes      | Custom order number (not more than 40 characters, and cannot be special characters, such as Martian characters, etc.), can not be repeated in the pending order. If vacant, the system will automatically assign value |
| size                  | String     | Yes      | Quantity to buy or sell (value not equal to 0 or negative)                                                                                                                                                             |
| type                  | String     | Yes      | 1：Open long, 2:Open short,3: Close long,4: Close short                                                                                                                                                                 |
| order\_type           | String     | Yes      | 0: Normal order (Unfilled and 0 imply normal limit order) 1: Post only 2: Fill or Kill 3: Immediate Or Cancel                                                                                                          |
| match\_price          | String     | Yes      | <p>0 Limit price</p><p>1 market price</p>                                                                                                                                                                              |
| price                 | String     | Yes      | price                                                                                                                                                                                                                  |
| presetTakeProfitPrice | BigDecimal | Yes      | Preset take profit price                                                                                                                                                                                               |
| presetStopLossPrice   | BigDecimal | Yes      | Preset stop Loss Price                                                                                                                                                                                                 |

> **Response**:

```
{
    "client_oid":"ww#123456",      //Client  ID 
    "order_id":"513466539039522813"   //Order ID 
}
```

**Response Filed**

| Field       | Description |
| ----------- | ----------- |
| client\_oid | Client ID   |
| order\_id   | Order ID    |

### Place Multiple Orders <a href="#place-multiple-orders-trade" id="place-multiple-orders-trade"></a>

Rate Limit：10 requests per second

**HTTP Requests** Place multiple orders&#x20;

* POST /api/swap/v3/order/batchOrders

**Request Parameter**

| Parameters    | Type   | Required | Description                                                                                                                                                                                        |
| ------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| symbol        | String | Yes      | Contract name                                                                                                                                                                                      |
| orderDataList | List   | Yes      | Object attributes, e.g (price=5,size=2,type=1,match\_price=1,order\_type=1,client\_oid="abc"),The fields refer to the \[Contract trading] endpoints, and can only process up to 20 orders in batch |

> **Response**:

```
{
    "result":true,  
    "order_info":[
        {
            "result":true,         //Result of an Order
            "client_oid":"dxdanzi",     //Client  ID
            "order_id":"513468410013679613"   //Order ID
        },
        {
            "result":true,
            "client_oid":"dxdanzi",
            "order_id":"513468410001096713"
        }
    ]
}
```

**Response Filed**

| Filed       | Description   |
| ----------- | ------------- |
| result      | Contract name |
| client\_oid | Client ID     |
| order\_id   | Order ID      |

### Cancel Order <a href="#cancel-order-trade" id="cancel-order-trade"></a>

Rate Limit：10 requests per seconds

**HTTP Requests** request to cancel order

* POST /api/swap/v3/order/cancel\_order

**Request Parameter**

| Parameters | Type   | Required | Description   |
| ---------- | ------ | -------- | ------------- |
| symbol     | String | Yes      | Contract name |
| orderId    | String | Yes      | Order ID      |

> **Response**:

```
{
   "symbol":"cmt_btcusdt",          //Contract name
   "order_id":"513468410013679613",   //Order ID
   "client_oid":"bitget#123456",     //Client ID
   "result":true                    //Cancellation status
}
```

**Response Filed**

| Filed       | Description         |
| ----------- | ------------------- |
| symbol      | Contract name       |
| order\_id   | Order id            |
| client\_oid | Client id           |
| result      | Cancellation status |

### Cancel Multiple Orders <a href="#cancel-multiple-orders-trade" id="cancel-multiple-orders-trade"></a>

Rate Limit：10 requests per seconds

**HTTP Requests** Cancel multiple orders

* POST /api/swap/v3/order/cancel\_batch\_orders

**Request Parameter**

| Parameters | Type   | Required | Description          |
| ---------- | ------ | -------- | -------------------- |
| symbol     | String | Yes      | Contract name        |
| ids        | List   | Yes      | Order id combination |

> **Response**:

```
{
   "symbol":"cmt_btcusdt",      //Contract name
   "result":true,              //processing result
   "order_ids":[
          "258414711",   //Successful id
          "478585558"
    ],
   "fail_infos":[
          {
        "order_id":"258414711",   //Failed id
        "err_code":"401",        //Error code
        "err_msg":""            //Error message
     }
  ]
}
```

**Response Filed**

| Filed      | Description       |
| ---------- | ----------------- |
| symbol     | Contract name     |
| result     | Processing result |
| order\_ids | Orders            |
| order\_id  | Order id          |
| err\_code  | Error code        |
| err\_msg   | Error message     |

### Get The Order Details By Order Id <a href="#get-the-order-details-of-an-order" id="get-the-order-details-of-an-order"></a>

Rate Limit：10 requests per second

**HTTP Requests** get the order details by order id

* GET /api/swap/v3/order/detail

**Request Parameter**

| Parameters | Type   | Required | Description   |
| ---------- | ------ | -------- | ------------- |
| symbol     | String | Yes      | Contract name |
| orderId    | String | Yes      | Order id      |

> **Response**:

```
{
     "symbol":"cmt_btcusdt",    //Contract name
     "size":"12",              //The amount in this order
     "timestamp":"15582271175271",     //Obsolete field
     "client_oid":"cmdtde",           //Client ID
     "createTime":"1698475585258",   //Creation time
     "filled_qty":"0",              //The amount which has been filled
     "fee":"0",                    //Transaction fee
     "order_id":"513468410013679613",    //Order ID
     "price":"12",                      //The limit price of limit order 
     "price_avg":"0",                  //Average filled price
     "status":"-1",                   //Order status
     "type":"1",                     //Commission type
     "order_type":"0",              //Order type
     "totalProfits":"253"          //Total profit and loss          
}
```

**Response Filed**

| Filed        | Description                                                                                                                                                                                     |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| symbol       | Contract name                                                                                                                                                                                   |
| size         | The amount in this order                                                                                                                                                                        |
| timestamp    | System time                                                                                                                                                                                     |
| client\_oid  | Client id                                                                                                                                                                                       |
| createTime   | Creation time                                                                                                                                                                                   |
| filled\_qty  | The amount which has been filled                                                                                                                                                                |
| fee          | Transaction fee                                                                                                                                                                                 |
| order\_id    | Order id                                                                                                                                                                                        |
| price        | The limit price of limit order                                                                                                                                                                  |
| price\_avg   | Average filled price                                                                                                                                                                            |
| status       | Order status -1 Cancelled successful 0 submitted 1partial-filled 2filled                                                                                                                        |
| type         | Commission type, 1,Open long 2 Open short 3 Close long 4 Close short 5 Buy limit 6Sell limit 7.Long close agreement 8. Short close agreement 9. Forced liquidity long 10 Forced liquidity short |
| order\_type  | Order Type 0. Normal limit order 1. Only be Maker (Post only)"2 Fill or Kill (FOK) 3. Immediate or Cancel (IOC)                                                                                 |
| totalProfits | Total profit and loss                                                                                                                                                                           |

### Get order history commission <a href="#id-7278e3bda7" id="id-7278e3bda7"></a>

Rate Limit：10 requests per second

**HTTP Requests** Get order history commission

* GET /api/swap/v3/order/history

**Request Parameter**

| Parameters | Type    | Required | Description                                                                                       |
| ---------- | ------- | -------- | ------------------------------------------------------------------------------------------------- |
| symbol     | String  | Yes      | Contract name                                                                                     |
| pageIndex  | String  | Yes      | Page number, empty default first page, starting from 1                                            |
| pageSize   | String  | Yes      | Number of data per page                                                                           |
| createDate | Integer | Yes      | Number of days (the number of days must be less than or equal to 90, cannot be a negative number) |

> **Response**:

```
[
   {
     "symbol":"cmt_btcusdt", //合约名称
     "size":"12", //委托数量
     "client_oid":"cmdtde", //客户端标识
     "createTime":"1698475585258", //创建时间戳
     "filled_qty":"0", //成交数量
     "fee":"0", //手续费
     "order_id":"513468410013679613", //订单id
     "price":"12", //委托价格
     "price_avg":"0", //成交均价
     "status":"-1", //订单状态
     "type":"1", //委托类型
     "order_type":"0", //订单类型
     "totalProfits":"253" //总盈亏
 }
]
```

**Response Filed**

| Parameters   | Description                                                                                                                                                                                     |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| symbol       | Contract name                                                                                                                                                                                   |
| size         | The amount in this order                                                                                                                                                                        |
| client\_oid  | Client id                                                                                                                                                                                       |
| createTime   | Creation time                                                                                                                                                                                   |
| filled\_qty  | The amount which has been filled                                                                                                                                                                |
| fee          | Transaction fee                                                                                                                                                                                 |
| order\_id    | Order id                                                                                                                                                                                        |
| price        | The limit price of limit order                                                                                                                                                                  |
| price\_avg   | Average filled price                                                                                                                                                                            |
| status       | Order status -1 Cancelled successful 0 submitted 1partial-filled 2filled                                                                                                                        |
| type         | Commission type, 1,Open long 2 Open short 3 Close long 4 Close short 5 Buy limit 6Sell limit 7.Long close agreement 8. Short close agreement 9. Forced liquidity long 10 Forced liquidity short |
| order\_type  | Order Type 0. Normal limit order 1. Only be Maker (Post only)"2 Fill or Kill (FOK) 3. Immediate or Cancel (IOC)                                                                                 |
| totalProfits | Total profit and loss                                                                                                                                                                           |

### Get the current order of the order <a href="#get-the-current-order-of-the-order" id="get-the-current-order-of-the-order"></a>

Rate Limit：10 requests per second

**HTTP Requests** Get the current order of the order

* GET /api/swap/v3/order/current&#x20;

**Request Parameter**

| Parameters | Type   | Required | Description   |
| ---------- | ------ | -------- | ------------- |
| symbol     | String | Yes      | Contract name |

> **Response**:

```
[
   {
          "symbol":"cmt_btcusdt",    //Contract name
          "size":"12",              //The amount in this order
          "client_oid":"cmdtde",           //Client ID
          "createTime":"1698475585258",   //Creation time
          "filled_qty":"0",              //The amount which has been filled
          "fee":"0",                    //Transaction fee
          "order_id":"513468410013679613",    //Order ID
          "price":"12",                      //The limit price of limit order 
          "price_avg":"0",                  //Average filled price
          "status":"-1",                   //Order status
          "type":"1",                     //Commission type
          "order_type":"0",              //Order type
          "totalProfits":"253"          //Total profit and loss    
 }
]
```

**Response Filed**

| Filed        | Description                                                                                                                                                                                     |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| symbol       | Contract name                                                                                                                                                                                   |
| size         | The amount in this order                                                                                                                                                                        |
| client\_oid  | Client id                                                                                                                                                                                       |
| createTime   | Creation time                                                                                                                                                                                   |
| filled\_qty  | The amount which has been filled                                                                                                                                                                |
| fee          | Transaction fee                                                                                                                                                                                 |
| order\_id    | Order id                                                                                                                                                                                        |
| price        | The limit price of limit order                                                                                                                                                                  |
| price\_avg   | Average filled price                                                                                                                                                                            |
| status       | Order status -1 Cancelled successful 0 submitted 1partial-filled 2filled                                                                                                                        |
| type         | Commission type, 1,Open long 2 Open short 3 Close long 4 Close short 5 Buy limit 6Sell limit 7.Long close agreement 8. Short close agreement 9. Forced liquidity long 10 Forced liquidity short |
| order\_type  | Order Type 0. Normal limit order 1. Only be Maker (Post only)"2 Fill or Kill (FOK) 3. Immediate or Cancel (IOC)                                                                                 |
| totalProfits | Total profit and loss                                                                                                                                                                           |

### Get Transaction Details <a href="#get-transaction-details" id="get-transaction-details"></a>

Rate Limit：10 requests per second

**HTTP Requests** get transaction details

* GET /api/swap/v3/order/fills

**Request Parameter**

| Parameters | Type   | Required | Description   |
| ---------- | ------ | -------- | ------------- |
| symbol     | String | Yes      | Contract name |
| orderId    | String | Yes      | Order id      |

> **Response**:

```
[
  {
      "symbol":"cmt_btcusdt",    //Contract name
      "trade_id":"6667390",     //trade Id
      "order_id":"525946425993854915",   //order id
      "price":"9839.00",      //deal price
      "order_qty":"3466",    //Quantity
      "fee":"-0.0000528407360000",    //transaction fee
      "timestamp":"1561121514442",   //Creation time
      "exec_type":"M",              //Liquidity direction   Taker or maker (T or M)
      "side":"3",                 //Commission type    Mark obsolete
      "delegateType":"3"          //Commission type
}
]
```

**Response  Filed**

| Parameters   | Description                                                                                                                                                                                     |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| symbol       | Contract name                                                                                                                                                                                   |
| trade\_id    | Trade Id                                                                                                                                                                                        |
| order\_id    | Order id                                                                                                                                                                                        |
| price        | Deal price                                                                                                                                                                                      |
| order\_qty   | Quantity                                                                                                                                                                                        |
| fee          | transaction fee                                                                                                                                                                                 |
| timestamp    | Creation time                                                                                                                                                                                   |
| exec\_type   | Liquidity direction Taker or maker (T or M)                                                                                                                                                     |
| delegateType | Commission type, 1,Open long 2 Open short 3 Close long 4 Close short 5 Buy limit 6Sell limit 7.Long close agreement 8. Short close agreement 9. Forced liquidity long 10 Forced liquidity short |

### New Trigger Order <a href="#place-order-with-stop-limit" id="place-order-with-stop-limit"></a>

Rate Limit：10 requests per second

**HTTP Requests** New trigger order

* POST /api/swap/v3/order/plan\_order

**Request Parameter**

| Parameters     | Type   | Required | Description                                                                                     |
| -------------- | ------ | -------- | ----------------------------------------------------------------------------------------------- |
| symbol         | String | Yes      | Contract name                                                                                   |
| client\_oid    | String | Yes      | not more than 40 characters, and cannot be special characters, such as Martian characters, etc. |
| size           | String | Yes      | Quantity to buy or sell (value not equal to 0 or negative)）                                     |
| type           | String | Yes      | <p>1 Open position </p><p>2 Close position</p>                                                  |
| holdSide       | String | Yes      | <p>Position Direction </p><p>1 Long,2 Short</p>                                                 |
| match\_type    | String | Yes      | <p>Order Type </p><p>0 Limit price;1 market price</p>                                           |
| execute\_price | String | Yes      | execute price                                                                                   |
| trigger\_price | String | Yes      | trigger price                                                                                   |

> **Response**:

```
{
      "client_oid":"bitget#123456",       //Client ID
      "order_id":"589579827556646928"    //trigger Order ID 
}
```

**Response  Filed**

| Filed       | Description      |
| ----------- | ---------------- |
| client\_oid | Client ID        |
| order\_id   | trigger order id |

### Cancel Trigger Order <a href="#id-2857693297" id="id-2857693297"></a>

Rate Limit：10 requests per second

**HTTP Requests** Cancel trigger order

* POST /api/swap/v3/order/cancel\_plan

**Request Parameter**

| Parameters | Type   | Required | Description   |
| ---------- | ------ | -------- | ------------- |
| symbol     | String | Yes      | Contract name |
| orderId    | String | Yes      | order id      |

> **Response**:

```
{
     "order_id":"5895798275566469458",      //Order ID
     "client_oid":"bitget#123456",         //Client ID
     "result":false,                      //Status of cancellation
     "err_code":"403",                   //Code of cancellation 
     "err_msg":"order not exist"        //Reason of cancellation
}
```

**Response  Filed**

| Filed       | Description            |
| ----------- | ---------------------- |
| order\_id   | Order id               |
| client\_oid | Client id              |
| result      | Status of cancellation |
| err\_code   | Code of cancellation   |
| err\_msg    | Reason of cancellation |

### Get Current Trigger Orders <a href="#id-4db6b940df" id="id-4db6b940df"></a>

Rate Limit：10 requests per second

**HTTP Requests** Get current trigger orders

* GET /api/swap/v3/order/currentPlan

**Request Parameter**

| Parameters   | Type   | Required | Description                                                         |
| ------------ | ------ | -------- | ------------------------------------------------------------------- |
| symbol       | String | Yes      | Contract name                                                       |
| delegateType | String | Yes      | Commission type 1 Open long 2 Open short 3 Close long 4 Close short |
| pageIndex    | String | Yes      | Current page (1-200)                                                |
| pageSize     | String | Yes      | Number per page(1-100)                                              |
| startTime    | String | Yes      | Query start time                                                    |
| endTime      | String | Yes      | Query stop time                                                     |

> **Response**:

```
{
      "list":[
              {
                 "symbol":"cmt_btcusdt",     //Contract name
                 "execute_count":"0",       //amount of Stop
                 "delegate_count":"1222222",     //amount of Limit
                 "create_time":1576294708136,   //Created time
                 "update_time":1576294708136,  //Updated time
                 "direction":1,               //Direction
                 "direction_desc":"开多",     //Description of direction
                 "trigger_price":"22222210.0",       //Stop price 
                 "execute_price":"7490.0",          //limit price (execute price) 
                 "order_id":"589588227514433528",  //Order ID
                 "order_type":0,                  //Order Type
                 "status":1,                     //status
                 "status_desc":"status",        //Description of status
                 "create_trade_price":"7490"   //Executed price of stop limit
           }
         ],
    "nextPage":false   //Next page 
}
```

**Response  Filed**

| Filed                | Description                                                                       |
| -------------------- | --------------------------------------------------------------------------------- |
| symbol               | Contract name                                                                     |
| nextPage             | Next page                                                                         |
| execute\_count       | Amount of Stop                                                                    |
| delegate\_count      | Wmount of Limit                                                                   |
| create\_time         | Created time                                                                      |
| update\_time         | Updated time                                                                      |
| direction            | Direction 1.Open long 2.Open short 3 Close long 4 Close short                     |
| direction\_desc      | 1.Open long 2.Open short 3 Close long 4 Close short                               |
| trigger\_price       | Trigger price                                                                     |
| execute\_price       | Execute price                                                                     |
| order\_id            | Order id                                                                          |
| order\_type          | <p>Order Type </p><p>0 Limit price;1 market price</p>                             |
| status               | Status 1: waiting to order 2: order placing 3: failed status 4 under cancellation |
| status\_desc         | 1: waiting to order 2: order placing 3: failed status 4 under cancellation        |
| create\_trade\_price | Executed trade price                                                              |

### Get The History Of Trigger Order <a href="#get-the-history-of-stop-limit" id="get-the-history-of-stop-limit"></a>

Rate Limit：10 requests per second

**HTTP Requests**  Get The History Of Trigger Order

* GET /api/swap/v3/order/historyPlan

**Request Parameter**

| Parameters   | Type   | Required | Description                                                         |
| ------------ | ------ | -------- | ------------------------------------------------------------------- |
| symbol       | String | Yes      | Contract name                                                       |
| delegateType | String | Yes      | Commission type 1 Open long 2 Open short 3 Close long 4 Close short |
| pageIndex    | String | Yes      | current page(1-200)                                                 |
| pageSize     | String | Yes      | Number per page(1-100)                                              |
| startTime    | String | No       | Query start time                                                    |
| endTime      | String | No       | Query end time                                                      |

> **Response**:

```
{
        "list":[
                    {
                       "symbol":"cmt_btcusdt",     //Contract name
                       "execute_count":"0",       //amount of Stop
                       "delegate_count":"1222222",     //amount of Limit
                       "create_time":1576294708136,   //Created time
                       "update_time":1576294708136,  //Updated time
                       "direction":1,               //Direction
                       "direction_desc":"开多",     //Description of direction
                       "trigger_price":"22222210.0",       //Stop price 
                       "execute_price":"7490.0",          //limit price (execute price) 
                       "order_id":"589588227514433528",  //Order ID
                       "order_type":0,                  //Order Type
                       "status":1,                     //status
                       "status_desc":"status",        //Description of status
                       "create_trade_price":"7490"   //Executed price of stop limit
                 }
               ],
          "nextPage":false   //Next page 
}

```

**Response  Filed**

| Filed                | Description                                                                               |
| -------------------- | ----------------------------------------------------------------------------------------- |
| symbol               | Contract name                                                                             |
| nextPage             | Next page                                                                                 |
| execute\_count       | amount of limit                                                                           |
| delegate\_count      | amount of order                                                                           |
| create\_time         | Created time                                                                              |
| update\_time         | Updated time                                                                              |
| direction            | Direction 1.Open long 2.Open short 3 Close long 4 Close short                             |
| direction\_desc      | Direction                                                                                 |
| trigger\_price       | trigger price                                                                             |
| execute\_price       | execute price                                                                             |
| order\_id            | Order ID                                                                                  |
| order\_type          | <p>0 Limit price </p><p>1 Market price</p>                                                |
| status               | 1: waiting to order 2: order placing 3: failed status 4 under cancellation                |
| status\_desc         | description of 1: waiting to order 2: order placing 3: failed status 4 under cancellation |
| create\_trade\_price | Executed trade price                                                                      |
