跳到主要內容

修改訂單

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

Request

HTTP MethodPUT
HTTP URL/v1/trade/order

Parameters

Content-Type: application/json; charset=utf-8

NameTypeRequiredDescription
order_idstringYES訂單 ID
quantitystringYES改單數量,例如:200
pricestringNO改單價格,例如:388.5

LO / ELO / ALO / ODD / LIT 訂單必填
trigger_pricestringNO觸發價格,例如:388.5

LIT / MIT 訂單必填
limit_offsetstringNO指定價差

TSLPAMT / TSLPPCT 訂單必填
trailing_amountstringNO跟蹤金額

TSLPAMT 訂單必填
trailing_percentstringNO跟蹤漲跌幅

TSLPPCT 訂單必填
remarkstringNO備註 (最大 64 字符)

Request Example

from decimal import Decimal
from longport.openapi import TradeContext, Config

config = Config.from_env()
ctx = TradeContext(config)

ctx.replace_order(
order_id = "709043056541253632",
quantity = 100,
price = Decimal("100"),
)

Response

Response Headers

  • Content-Type: application/json

Response Example

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

Response Status

StatusDescriptionSchema
200提交成功,訂單已委托。None
400下單被拒絕,請求參數錯誤。None