Replace Order

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"
  }
}
FieldTypeRequiredDescription
idStringNRequest ID.
actionStringYMust be replace_order.
argsObjectYReplace parameters.
> orderIdStringYID of the order to amend. The order must currently be in OPEN or PARTIALLY_FILLED state.
> replaceQtyStringNNew total quantity for the order. If omitted, the current quantity is kept.
> replacePriceStringNNew price for the order. If omitted, the current price is kept.

At least one of replaceQty or replacePrice must 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: 200000 means LTP has accepted the replace request and submitted it to the exchange. Monitor the Orders push channel for action: "AMEND_COMPLETED" to confirm the new price or quantity is in effect. If the exchange rejects the change, you will receive action: "AMEND_FAILED" instead.

FieldTypeDescription
idStringRequest ID.
eventStringreplace_order on success, error on failure.
codeLong200000 = replace request accepted. Any other value indicates an error — check msg for the reason.
msgString"Success" on success, or an error message explaining why the replace was rejected.
dataObjectPresent on success only.
> orderIdStringThe order ID. Unchanged from the original order — replace does not create a new order ID.
> orderStateStringOrder state at the time of this response (typically OPEN).