# Spot Trade Endpoints

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

Rate limit rule: 10 requests/1s

**HTTP Request**  new order

* POST /api/spot/v1/trade/orders

**Request Parameter**

| Parameters    | Type   | Required | Description                                                                           |
| ------------- | ------ | -------- | ------------------------------------------------------------------------------------- |
| symbol        | String | Yes      | Symbol：[/products](https://weex-1.gitbook.io/en/spot-basic-info-endpoints#d990beddee) |
| side          | String | Yes      | Trade Direction                                                                       |
| orderType     | String | Yes      | Trade Type limit/market                                                               |
| force         | String | Yes      | Order Type                                                                            |
| price         | String | No       | Limit Order Price                                                                     |
| quantity      | String | Yes      | Amount                                                                                |
| clientOrderId | String | No       | Client Order ID                                                                       |

> **Response:**

```
{
    "code":"00000",
    "msg":"success",
    "data":{
        "orderId":"1001",
        "clientOrderId":"hgXjh89AsxleMSw"
    }
}
```

**Response Field**

| Field         | Description     |
| ------------- | --------------- |
| orderId       | order id        |
| clientOrderId | client order id |

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

Rate limit rule: 5 requests/1s

**HTTP Request** Place Multiple Orders

* POST /api/spot/v1/trade/batch-orders

**Request Parameter**

| Parameters | Type   | Required | Description                                                                            |
| ---------- | ------ | -------- | -------------------------------------------------------------------------------------- |
| symbol     | String | Yes      | Symbol: [/products](https://weex-1.gitbook.io/en/spot-basic-info-endpoints#d990beddee) |
| orderList  | List   | Yes      | List of Orders                                                                         |

* orderList Field

| Parameters    | Type   | Required | Description             |
| ------------- | ------ | -------- | ----------------------- |
| side          | String | Yes      | Trade Direction         |
| orderType     | String | Yes      | Trade Type limit/market |
| force         | String | Yes      | Order Type              |
| price         | String | No       | Limit Order Price       |
| quantity      | String | Yes      | Amoun                   |
| clientOrderId | String | No       | Client Order ID         |

> **Response:**

```
{
    "code":"00000",
    "msg":"success",
    "data":{
        "resultList":[
            {
                "clientOrderId":"hgXjh89AsxleMSw",
                "orderId":"1001"
            }
        ]
    }
}
```

### Cancel Order <a href="#fc150cab0e" id="fc150cab0e"></a>

Rate limit rule: 10 requests/1s

**HTTP Request** Cancel order

* POST /api/spot/v1/trade/cancel-order

**Request Parameter**

| Parameters | Type   | Required | Description                                                                            |
| ---------- | ------ | -------- | -------------------------------------------------------------------------------------- |
| symbol     | String | Yes      | Symbol ：[/products](https://weex-1.gitbook.io/en/spot-basic-info-endpoints#d990beddee) |
| orderId    | String | Yes      | Order id array                                                                         |

> **Response:**

```
{

  "code":"00000",
   "message":"success",
   "data":"1001"

}
```

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

Rate limit rule: 10 request/1s

**HTTP Request**  Cancel multiple orders

* POST /api/spot/v1/trade/cancel-batch-orders

**Request Parameter**

| Parameters | Type      | Required | Description                                                                           |
| ---------- | --------- | -------- | ------------------------------------------------------------------------------------- |
| symbol     | String    | Yes      | Symbol：[/products](https://weex-1.gitbook.io/en/spot-basic-info-endpoints#d990beddee) |
| orderIds   | String\[] | Yes      | Order id array                                                                        |

> **Response:**

```
{

  "code":"00000",
   "message":"success",
    "data":[
    "1001",
    "1002"
    ]

}   
```

### Get Order details <a href="#f876a4e1f9" id="f876a4e1f9"></a>

Rate limit rule: 10 request/1s

**HTTP Request** get  order  details by order id or client order id

* POST /api/spot/v1/trade/orderInfo

**Request Parameter**

| Parameters    | Type   | Required | Description                                                                           |
| ------------- | ------ | -------- | ------------------------------------------------------------------------------------- |
| symbol        | String | Yes      | Symnol：[/products](https://weex-1.gitbook.io/en/spot-basic-info-endpoints#d990beddee) |
| orderId       | String | Yes      | Order id                                                                              |
| clientOrderId | String | No       | Custom order id                                                                       |

> **Response:**

```
{
  "code":"00000",
  "message":"success",
"data":[{
  "accountId":"10012",
  "symbol":"btcusdt_spbl",
  "orderId":"2222222",
  "clientOrderId":"xxxxxxx",
  "price":"34245.12",
  "quantity":"1",  
  "orderType":"limit",
  "side":"buy",
  "status":"new",
  "fillPrice":"0",
  "fillQuantity":"0",
  "fillTotalAmount":"0",
  "cTime":"1622697148"
}]
}
```

**Response Field**

| Field           | Description              |
| --------------- | ------------------------ |
| accountId       | account id               |
| symbol          | Currency pair name       |
| orderId         | Order id                 |
| clientOrderId   | Custom id                |
| price           | price                    |
| quantity        | Order quantity           |
| orderType       | Order type               |
| side            | Order direction          |
| status          | status                   |
| fillPrice       | Transaction price        |
| fillQuantity    | Transaction quantity     |
| fillTotalAmount | Total transcation volume |
| cTime           | Created time             |

### Get Pending Orders <a href="#id-19671a1099" id="id-19671a1099"></a>

Rate limit rule: 10 request/1s

**HTTP Request** Get unfilled and partially filled uncancelled orders

* POST /api/spot/v1/trade/open-orders

**Request Parameter**

| Parameters | Type   | Required | Description                                                                           |
| ---------- | ------ | -------- | ------------------------------------------------------------------------------------- |
| symbol     | String | Yes      | Symbol：[/products](https://weex-1.gitbook.io/en/spot-basic-info-endpoints#d990beddee) |

> **Response:**

```
{
  "code":"00000",
  "message":"success",
"data":[{
  "accountId":"10012",
  "symbol":"btcusdt_spbl",
  "orderId":"2222222",
  "clientOrderId":"xxxxxxx",
  "price":"34829.12",
  "quantity":"1",  
  "orderType":"limit",
  "side":"buy",
  "status":"new",
  "fillPrice":"0",
  "fillQuantity":"0",
  "fillTotalAmount":"0",
  "cTime":"1622697148"
}]
}
```

**Response Field**

| Field           | Description              |
| --------------- | ------------------------ |
| accountId       | Account ID               |
| symbol          | Currency pair            |
| orderId         | order id                 |
| clientOrderId   | Custom id                |
| price           | Order price              |
| quantity        | Order quantity           |
| orderType       | Order type               |
| side            | Order direction          |
| status          | status                   |
| fillPrice       | Transaction price        |
| fillQuantity    | Transaction quantity     |
| fillTotalAmount | Total transcation volume |
| cTime           | Created time             |

### Get Traded Order Record <a href="#b9220b5487" id="b9220b5487"></a>

Rate limit rule: 20 request/1s

**HTTP Request** Get all filled and cancelled orders

* POST /api/spot/v1/trade/history

**Request Parameter**

| 参数名    | Type    | Required | Description                                                                           |
| ------ | ------- | -------- | ------------------------------------------------------------------------------------- |
| symbol | String  | Yes      | Symbol：[/products](https://weex-1.gitbook.io/en/spot-basic-info-endpoints#d990beddee) |
| after  | String  | No       | use orderId, the data before this orderId desc                                        |
| before | String  | No       | use orderId, the data after this orderId asc                                          |
| limit  | Integer | No       | default 100,  max. is 500                                                             |

> **Response:**

```
{
  "code":"00000",
  "message":"success",
"data":[{
  "accountId":"10012",
  "symbol":"btcusdt_spbl",
  "orderId":"2222222",
  "clientOrderId":"xxxxxxx",
  "price":"34982.12",
  "quantity":"1",  
  "orderType":"limit",
  "side":"buy",
  "status":"new",
  "fillPrice":"34982.12",
  "fillQuantity":"1",
  "fillTotalAmount":"34982.12",
  "cTime":"1622697148"
}]
}
```

**Response Field**

| Field           | Description              |
| --------------- | ------------------------ |
| accountId       | Account ID               |
| symbol          | Currency pair            |
| orderId         | Order id                 |
| clientOrderId   | Custom ID                |
| price           | Order price              |
| quantity        | Order quantity           |
| orderType       | Order type               |
| side            | Order direction          |
| status          | Order status             |
| fillPrice       | Transaction price        |
| fillQuantity    | Transaction quantity     |
| fillTotalAmount | Total transcation volume |
| cTime           | Created time             |

### Get Transaction Details <a href="#id-106a02279b" id="id-106a02279b"></a>

Rate limit rule: 20 request/1s

**HTTP Request** get transaction detail history

* POST /api/spot/v1/trade/fills

**Request Parameter**

| Parameters | Type    | Required | Description                                                                           |
| ---------- | ------- | -------- | ------------------------------------------------------------------------------------- |
| symbol     | String  | Yes      | Symbol：[/products](https://weex-1.gitbook.io/en/spot-basic-info-endpoints#d990beddee) |
| orderId    | String  | No       | Order ID                                                                              |
| after      | String  | No       | use in orderId, the data before this orderId desc                                     |
| before     | String  | No       | use in the orderId, the data after this orderId asc                                   |
| limit      | Integer | No       | default  100,  max. 500                                                               |

> **Response:**

```
{
  "code":"",
  "message":"",
  "data":[{
  "accountId":"1001",
  "symbol":"btcusdt_spbl",
  "orderId":"100021",
  "fillId":"102211",
  "orderType":"limit",
  "side":"buy",
  "fillPrice":"38293.12",
  "fillQuantity":"1",
  "fillTotalAmount":"38293.12",
  "cTime":"1622697148",
  "feeCcy":"btc",
  "fees":"0.0001"
}]
}
```

**Response** Field

| Field           | Description              |
| --------------- | ------------------------ |
| accountId       | Account ID               |
| symbol          | Currency pair            |
| orderId         | Order id                 |
| fillId          | Transaction ID           |
| orderType       | Order type               |
| side            | Order direction          |
| fillPrice       | Transaction price        |
| fillQuantity    | Transaction quantity     |
| fillTotalAmount | Total transaction volume |
| cTime           | Creatied time            |
| feeCcy          | Coin for transaction fee |
| fees            | Transaction fees         |
