跳转到内容

修改订单

该接口用于修改订单的价格,数量。

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

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

StatusDescriptionSchema
200提交成功,订单已委托。None
400下单被拒绝,请求参数错误。None