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 Method | PUT |
| HTTP URL | /v1/trade/order |
Parameters
Content-Type: application/json; charset=utf-8
| Name | Type | Required | Description |
|---|---|---|---|
| order_id | string | YES | Order ID |
| quantity | string | YES | Replaced quantity, example: 100 |
| price | string | NO | Replaced price, example: 388.5LO / ELO / ALO / ODD / LIT Order Required |
| trigger_price | string | NO | Trigger price, example: 388.5LIT / MIT Order Required |
| limit_offset | string | NO | Limit offset amountTSLPAMT / TSLPPCT Order Required |
| trailing_amount | string | NO | Trailing amountTSLPAMT Order Required |
| trailing_percent | string | NO | Trailing percentTSLPPCT Order Required |
| remark | string | NO | Remark (Maximum 64 characters) |
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 | The submission was successful and the order was commissioned. | None |
| 400 | The replace was rejected with an incorrect request parameter. | None |