# 修改訂單

`PUT` `/v1/trade/order`

該接口用於修改訂單的價格，數量。

## Parameters

### Request Body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `order_id` | string | Yes | 訂單 ID |
| `quantity` | string | Yes | 改單數量，例如：`200` |
| `price` | string | No | 改單價格，例如：`388.5`. `LO` / `ELO` / `ALO` / `ODD` / `LIT` 訂單必填 |
| `trigger_price` | string | No | 觸發價格，例如：`388.5`. `LIT` / `MIT` 訂單必填 |
| `limit_offset` | string | No | 指定價差。`TSLPAMT` / `TSLPPCT` 訂單在 `limit_depth_level` 為 0 時必填 |
| `trailing_amount` | string | No | 跟蹤金額。`TSLPAMT` 訂單必填 |
| `trailing_percent` | string | No | 跟蹤漲跌幅。`TSLPPCT` 訂單必填 |
| `remark` | string | No | 備註 (最大 64 字符) |
| `limit_depth_level` | integer | No | 指定買賣檔位，`TSLPAMT` / `TSLPPCT` 訂單必填 |
| `monitor_price` | string | No | 監控價格，`TSLPAMT` / `TSLPPCT` 訂單必填 |
| `trigger_count` | integer | No | 觸發次數，`LIT` / `MIT` / `TSLPAMT` / `TSLPPCT` 訂單必填 |
| `attached_params` | object | No | 附加單參數（止盈止損） |
| `attached_params.attached_order_type` | string | No | 附加單訂單類型。**可選值：**, `PROFIT_TAKER` - 止盈，`STOP_LOSS` - 止損，`BRACKET` - 括號單 |
| `attached_params.profit_taker_price` | string | No | 止盈觸發價格 |
| `attached_params.stop_loss_price` | string | No | 止損觸發價格 |
| `attached_params.time_in_force` | string | No | 附加單有效期類型。**可選值：**, `Day` - 當日有效，`GTC` - 撤單前有效，`GTD` - 到期前有效（此時繼承主單 expire_date） |
| `attached_params.expire_time` | integer | No | 到期時間（Unix 時間戳，單位秒） |
| `attached_params.profit_taker_id` | integer | No | 止盈單 ID，修改現有止盈單時填寫 |
| `attached_params.stop_loss_id` | integer | No | 止損單 ID，修改現有止損單時填寫 |
| `attached_params.cancel_all_attached` | boolean | No | 是否取消所有附加單 |
| `attached_params.main_id` | integer | No | 主單 ID |
| `attached_params.quantity` | string | No | 附加單數量 |
| `attached_params.market_price` | string | No | 市價 |
| `attached_params.activate_order_type` | string | No | 觸發後提交的訂單類型，例如 `LIT`（限價單）或 `MIT`（市價單） |
| `attached_params.profit_taker_submit_price` | string | No | 止盈限價委託價格，`activate_order_type` 為 `LIT` 時必填 |
| `attached_params.stop_loss_submit_price` | string | No | 止損限價委託價格，`activate_order_type` 為 `LIT` 時必填 |
| `attached_params.activate_rth` | string | No | 觸發後提交的訂單是否允許盤前盤後。**可選值：**, `RTH_ONLY` - 不允許盤前盤後，`ANY_TIME` - 允許盤前盤後 |
| `attached_params.profit_taker_depth_level` | integer | No | 止盈限價委託價格的買賣檔位，`activate_order_type` 為 `LIT` 時有效 |
| `attached_params.stop_loss_depth_level` | integer | No | 止損限價委託價格的買賣檔位，`activate_order_type` 為 `LIT` 時有效 |

## Request Example

```bash
curl --request PUT \
  --url 'https://openapi.longbridge.com/v1/trade/order' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{"order_id":"<order_id>","quantity":"<quantity>","price":"<price>","trigger_price":"<trigger_price>","limit_offset":"<limit_offset>","trailing_amount":"<trailing_amount>","trailing_percent":"<trailing_percent>","remark":"<remark>","limit_depth_level":0,"monitor_price":"<monitor_price>","trigger_count":0,"attached_params":{"attached_order_type":"<attached_order_type>","profit_taker_price":"<profit_taker_price>","stop_loss_price":"<stop_loss_price>","time_in_force":"<time_in_force>","expire_time":0,"profit_taker_id":0,"stop_loss_id":0,"cancel_all_attached":false,"main_id":0,"quantity":"<quantity>","market_price":"<market_price>","activate_order_type":"<activate_order_type>","profit_taker_submit_price":"<profit_taker_submit_price>","stop_loss_submit_price":"<stop_loss_submit_price>","activate_rth":"<activate_rth>"}}'
```

## Response

### Response JSON Example

```json
{
  "code": 0,
  "message": "success",
  "data": {}
}
```
