Skip to main content

Replace Order

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

SDK Links

Python
longport.openapi.TradeContext.replace_order
Rust
longport::trade::TradeContext#replace_order
Go
TradeContext.ReplaceOrder
Node.js
TradeContext#replaceOrder

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 = Decimal(100),
price = Decimal(50),
)

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