修改訂單
該接口用於修改訂單的價格,數量。
SDK Links
Python  | longport.openapi.TradeContext.replace_order | 
Rust  | longport::trade::TradeContext#replace_order | 
Go  | TradeContext.ReplaceOrder | 
Node.js  | TradeContext#replaceOrder | 
Request 
| HTTP Method | PUT | 
| HTTP URL | /v1/trade/order | 
Parameters 
Content-Type: application/json; charset=utf-8
| Name | Type | Required | Description | 
|---|---|---|---|
| order_id | string | YES | 訂單 ID | 
| quantity | string | YES | 改單數量,例如:200 | 
| price | string | NO | 改單價格,例如:388.5LO / ELO / ALO / ODD / LIT 訂單必填 | 
| trigger_price | string | NO | 觸發價格,例如:388.5LIT / MIT 訂單必填 | 
| limit_offset | string | NO | 指定價差TSLPAMT / TSLPPCT 訂單必填 | 
| trailing_amount | string | NO | 跟蹤金額TSLPAMT 訂單必填 | 
| trailing_percent | string | NO | 跟蹤漲跌幅TSLPPCT 訂單必填 | 
| remark | string | NO | 備註 (最大 64 字符) | 
Request Example 
python
from decimal import Decimal
from longport.openapi import TradeContext, Config
config = Config.from_env()
ctx = TradeContext(config)
ctx.replace_order(
    order_id = "709043056541253632",
    quantity = Decimal(100),
    price = Decimal(50),
)Response 
Response Headers 
- Content-Type: application/json
 
Response Example 
json
{
  "code": 0,
  "message": "success",
  "data": {}
}Response Status 
| Status | Description | Schema | 
|---|---|---|
| 200 | 提交成功,訂單已委托。 | None | 
| 400 | 下單被拒絕,請求參數錯誤。 | None |