# Ws Place  batch orders

#### place\_batch\_orders

Signature verification: Yes

Interface permission: Trade

Rate Limit: Shared REST frequency limit

Interface description: This interface only supports websocket contract batch orders.

### Subscription Address

| Environment                         | Address                        |
| ----------------------------------- | ------------------------------ |
| Online                              | wss\://api.sunx.io/ws/v1/trade |
| Online (preferred by aws customers) | wss\://api.sunx.io/ws/v1/trade |

###

### Subscription Parameter

| Field Name | Type   | Description                                   |
| ---------- | ------ | --------------------------------------------- |
| op         | string | Required； Operator Name， place\_batch\_orders |
| cid        | string | Optional; Requests unique ID                  |
| data       | array  | batch order parameters                        |

### Request Parameter

| Parameter                | Data Type | Required | Description                                                                                                                                                                                        | Value Range                                                                                                    | Default Value                |
| ------------------------ | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------- |
| \<data>                  |           | false    |                                                                                                                                                                                                    |                                                                                                                |                              |
| contract\_code           | String    | false    | Symbol                                                                                                                                                                                             |                                                                                                                |                              |
| margin\_mode             | String    | false    | Margin mode: cross (Cross margin)                                                                                                                                                                  |                                                                                                                |                              |
| position\_side           | String    | false    | Position side                                                                                                                                                                                      | long: going long; short: going short; both: One-way mode. You must input long or short and both is default.    |                              |
| side                     | String    | false    | Order side                                                                                                                                                                                         | buy; sell                                                                                                      |                              |
| type                     | String    | false    | Order type; enumeration                                                                                                                                                                            | "market": market order; "limit": limit order; "post\_only": post-only order                                    |                              |
| price\_match             | String    | false    | BBO and price are mutually exclusive                                                                                                                                                               | opponent: counterparty price; "optimal\_5": Best 5 BBO; "optimal\_10": Best 10 BBO; "optimal\_20": Best 20 BBO |                              |
| client\_order\_id        | String    | false    | Order ID you entered                                                                                                                                                                               | Clients fill and maintain themselves. the value must be in \[1, 9223372036854775807]                           |                              |
| price                    | String    | false    | Price, applicable for limit orders only. No price input is required for market orders.                                                                                                             |                                                                                                                |                              |
| volume                   | String    | false    | Order size, specifically in Cont                                                                                                                                                                   |                                                                                                                |                              |
| reduce\_only             | Integer   | false    | Reduce only: 0 is false; 1 is true                                                                                                                                                                 |                                                                                                                |                              |
| time\_in\_force          | String    | false    | Enumerate FOK, IOC, and GTC. It is an optional field with GTC by default.                                                                                                                          |                                                                                                                |                              |
| tp\_trigger\_price       | String    | false    | Trigger price of your take profit order                                                                                                                                                            |                                                                                                                |                              |
| tp\_order\_price         | String    | false    | Price of your take profit order. (There is no need to input a price when using BBO.)                                                                                                               |                                                                                                                |                              |
| tp\_type                 | String    | false    | Type of your take profit order. "market" is default with no input. "market": market order; "limit": limit order. "optimal\_5": Best 5 BBO; "optimal\_10": Best 10 BBO; "optimal\_20": Best 20 BBO. |                                                                                                                |                              |
| tp\_trigger\_price\_type | String    | false    | Trigger price type of your take profit order. The last price is default.                                                                                                                           | "last": last price; "market": mark price                                                                       |                              |
| sl\_trigger\_price       | String    | false    | SL Trigger Price                                                                                                                                                                                   |                                                                                                                |                              |
| sl\_order\_price         | String    | false    | Price of your stop loss order. (There is no need to input a price when using BBO.)                                                                                                                 |                                                                                                                |                              |
| sl\_type                 | String    | false    | Type of your stop loss order. "market" is default with no input. "market": market order; "limit": limit order. "optimal\_5": Best 5 BBO; "optimal\_10": Best 10 BBO; "optimal\_20": Best 20 BBO.   |                                                                                                                |                              |
| sl\_trigger\_price\_type | String    | false    | Trigger price type of your stop loss order. The last price is default.                                                                                                                             | "last": last price; "market": mark price                                                                       |                              |
| price\_protect           | boolean   | false    | Price protection. "false" is default. The parameter is needed when you set TP/SL.                                                                                                                  | false or true                                                                                                  |                              |
| self\_match\_prevent     | String    | false    | Self-trading prevention                                                                                                                                                                            | Currently only supports cancel\_taker                                                                          | The default is cancel\_taker |
| \<data>                  |           | false    |                                                                                                                                                                                                    |                                                                                                                |                              |

Notes: Notes: position\_side is the side of your position. This parameter is optional in the One-way mode. The field is optional, and only "both" can be entered. However, in Hedge mode, this field is mandatory, and only "long" or "short" can be selected. In Hedge mode, "side" and "position\_side" need to be combined. Open long (Enter "buy" in the side field; "long" in the position\_side field) Open short (Enter "sell" in the side field; "short" in the position\_side field) Close long (Enter "sell" in the side field; "long" in the position\_side field) Close short (Enter "buy" in the side field; "short" in the position\_side field) In One-way mode, a long position returns "buy," while a short position returns "sell."

### Response Parameter

| Parameter         | Data Type    | Required | Description                                                                                        | Value Range                  |
| ----------------- | ------------ | -------- | -------------------------------------------------------------------------------------------------- | ---------------------------- |
| code              | int          | true     | Response Code                                                                                      | 200: Success, non 200: Error |
| message           | String       | true     | Response Description                                                                               |                              |
| \<data>           | object array | true     |                                                                                                    |                              |
| code              | int          | true     | Order Response Code                                                                                | 200: Success, non 200: Error |
| message           | String       | true     | Order Response Description                                                                         |                              |
| order\_id         | String       | true     | Order ID                                                                                           |                              |
| client\_order\_id | String       | true     | The order ID you entered when placing an order. The ID will not be returned if it is not provided. |                              |
| \</data>          |              | false    |                                                                                                    |                              |
| ts                | long         | true     |                                                                                                    |                              |

### Request Example

```
{
  "op": "place_batch_orders",
  "cid": "place_batch_orders_1234",
  "data": [
    {
      "time_in_force": "gtc",
      "price_protect": "true",
      "contract_code": "BTC-USDT",
      "margin_mode": "cross",
      "position_side": "long",
      "price": 5000,
      "volume": 1,
      "side": "buy",
      "lever_rate": 5,
      "type": "limit"
    },
    {
      "time_in_force": "gtc",
      "price_protect": "true",
      "contract_code": "BTC-USDT",
      "margin_mode": "cross",
      "position_side": "long",
      "price": 5000,
      "volume": 1,
      "side": "buy",
      "lever_rate": 5,
      "type": "limit"
    }
  ]
}
```

### Example of a Successful Request

```
{
  "code": 200,
  "message": "Success",
  "data": [
    {
      "orderId": "1358936204495511552",
      "clientOrderId": "1358936204495511552",
      "code": 200,
      "message": "Success"
    },
    {
      "orderId": "1358936204537454592",
      "clientOrderId": "1358936204537454592",
      "code": 200,
      "message": "Success"
    }
  ],
  "ts": 1744037238982,
  "cid": "place_batch_orders_1234"
}
```
