Skip to main content

Replace Order

This API is used to replace order, modify quantity or price

Request

HTTP MethodPUT
HTTP URL/v1/trade/order

Parameters

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

NameTypeRequiredDescription
order_idstringYESOrder ID
quantitystringYESReplaced quantity, example: 100
pricestringNOReplaced price, example: 388.5

LO / ELO / ALO / ODD / LIT Order Required
trigger_pricestringNOTrigger price, example: 388.5

LIT / MIT Order Required
limit_offsetstringNOLimit offset amount

TSLPAMT / TSLPPCT Order Required
trailing_amountstringNOTrailing amount

TSLPAMT Order Required
trailing_percentstringNOTrailing percent

TSLPPCT Order Required
remarkstringNORemark (Maximum 64 characters)

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
200The submission was successful and the order was commissioned.None
400The replace was rejected with an incorrect request parameter.None