
# 下条件单 (TRADE)

- **POST** ```/capi/v3/algoOrder```

<strong>请求权重</strong>

10s order rate limit(X-ORDER-COUNT-10S)为1; 1min order rate limit(X-ORDER-COUNT-1M)为1; IP rate limit(X-USED-WEIGHT-1M)为0


<div class='api-content-wrap'>
<div>


<strong>请求参数</strong>


| 参数名                   | 类型     | 是否必填  | 说明                                                             |
|-----------------------|--------|-------|----------------------------------------------------------------|
| symbol                | String | 是     | 交易对，例如 `BTCUSDT`。                                              |
| side                  | String | 是     | 买卖方向，`BUY` 或 `SELL`。                                           |
| positionSide          | String | 是     | 持仓方向，`LONG` 或 `SHORT`。                                         |
| type                  | String | 是     | 条件单类型，`STOP`、`TAKE_PROFIT`、`STOP_MARKET`、`TAKE_PROFIT_MARKET`、`TRAILING_MARKET`。 |
| quantity              | String | 是     | 下单数量，必须大于 0。                                                   |
| price                 | String | 条件必填  | 执行价格，当 `type` 为 `STOP` 或 `TAKE_PROFIT` 时必填。                    |
| triggerPrice          | String | 条件必填  | 触发价格，当 `type` 为 `STOP`、`TAKE_PROFIT`、`STOP_MARKET` 或 `TAKE_PROFIT_MARKET` 时必填。 |
| clientAlgoId          | String | 是     | 客户自定义条件单 ID（1-36 位，匹配 `^[\\.A-Z\:/a-z0-9_-]{1,36}$`）。          |
| presetTakeProfitPrice | String | 否     | 预设止盈触发价。                                                       |
| presetStopLossPrice   | String | 否     | 预设止损触发价。                                                       |
| TpWorkingType         | String | 否     | 止盈触发价类型：`CONTRACT_PRICE` 或 `MARK_PRICE`，默认 `CONTRACT_PRICE`。   |
| SlWorkingType         | String | 否     | 止损触发价类型：`CONTRACT_PRICE` 或 `MARK_PRICE`，默认 `CONTRACT_PRICE`。   |
| activatePrice         | String | 否     | 追踪止损激活价格，仅当 `type = TRAILING_MARKET` 时有效；不传则按 `workingType` 使用当前市场价格。 |
| callbackRate          | String | 条件必填  | 追踪止损回调比例，仅当 `type = TRAILING_MARKET` 时必填，取值范围 `[0.001, 0.9999]`。 |
| workingType           | String | 否     | 追踪委托激活和回调使用的价格类型：`CONTRACT_PRICE`、`MARK_PRICE`，默认 `CONTRACT_PRICE`。 |
| reduceOnly            | Boolean | 否    | 是否只减仓。                                                         |

</div>
<div class='api-align'>
  <div class='code-wrap'>
<strong>请求示例</strong>

```powershell
curl -X POST "https://api-contract.weex.com/capi/v3/algoOrder" \
   -H "ACCESS-KEY:*******" \
   -H "ACCESS-SIGN:*******" \
   -H "ACCESS-PASSPHRASE:*****" \
   -H "ACCESS-TIMESTAMP:1659076670000" \
   -H "Content-Type: application/json" \
   -d '{
     "symbol": "BTCUSDT",
     "side": "BUY",
     "positionSide": "LONG",
     "type": "STOP",
     "quantity": "0.01",
     "price": "68800",
     "triggerPrice": "68900",
     "clientAlgoId": "algo-20240201-1",
     "presetTakeProfitPrice": "70500",
     "presetStopLossPrice": "68000",
     "TpWorkingType": "MARK_PRICE",
     "reduceOnly": false
   }'
```
  </div>
  </div>

</div>

<div class='api-content-wrap'>
  <div>
<strong>返回参数</strong>


返回结构与[下单 (TRADE)](/zh-CN/products/futures/Transaction_API/PlaceOrder) 相同。

  </div>
  <div class='api-align'>

  <div class='code-wrap'>
<strong>返回示例</strong>

```json
{
  "orderId": "702345678901234700",
  "clientOrderId": "algo-20240201-1",
  "success": true,
  "errorCode": "",
  "errorMessage": ""
}
```
  </div>
    </div>
</div>
