Amend the price or quantity of an existing open order without cancelling it. The order ID stays the same after a successful replace. Two push messages follow on the Orders channel: first action: "AMEND_PENDING" when LTP submits the change to the exchange, then action: "AMEND_COMPLETED" (or "AMEND_FAILED") once the exchange confirms.
Rate Limit: 300 requests per 60 seconds
Request
Send a replace_order action with the order ID and the new price or quantity you want. You only need to include the fields you want to change — any field you omit keeps its current value.
{
"id": "XXX",
"action": "replace_order",
"args": {
"orderId": "XXXX",
"replaceQty": "1000",
"replacePrice": "60000"
}
}
| Field | Type | Required | Description |
|---|---|---|---|
id | String | N | Request ID. |
action | String | Y | Must be replace_order. |
args | Object | Y | Replace parameters. |
> orderId | String | Y | ID of the order to amend. The order must currently be in OPEN or PARTIALLY_FILLED state. |
> replaceQty | String | N | New total quantity for the order. If omitted, the current quantity is kept. |
> replacePrice | String | N | New price for the order. If omitted, the current price is kept. |
At least one of
replaceQtyorreplacePricemust be provided.
Response
The response is sent immediately after LTP accepts the replace request. It does not mean the exchange has applied the change yet.
Success:
{
"id": "XXXX",
"event": "replace_order",
"code": 200000,
"msg": "Success",
"data": {
"orderId": "XXXXX",
"orderState": "OPEN"
}
}
Failure:
{
"id": "***",
"event": "error",
"code": "60009",
"msg": "ReplaceOrder failed."
}
code: 200000means LTP has accepted the replace request and submitted it to the exchange. Monitor theOrderspush channel foraction: "AMEND_COMPLETED"to confirm the new price or quantity is in effect. If the exchange rejects the change, you will receiveaction: "AMEND_FAILED"instead.
| Field | Type | Description |
|---|---|---|
id | String | Request ID. |
event | String | replace_order on success, error on failure. |
code | Long | 200000 = replace request accepted. Any other value indicates an error — check msg for the reason. |
msg | String | "Success" on success, or an error message explaining why the replace was rejected. |
data | Object | Present on success only. |
> orderId | String | The order ID. Unchanged from the original order — replace does not create a new order ID. |
> orderState | String | Order state at the time of this response (typically OPEN). |
