replace-order — Replace Order

Cancels the original order and submits a new one. One of cancelOrderId and cancelOrigClientOrderId must be provided.

Request:

{
  "id": "5b",
  "op": "replace-order",
  "args": {
    "symbol": "BTCUSDC",
    "side": "BUY",
    "price": "61000",
    "quantity": "0.01",
    "cancelOrderId": 2198729355243696896,
    "newClientOrderId": "new-order-001",
    "timeInForce": "GTC",
    "cancelReplaceMode": "STOP_ON_FAILURE"
  }
}
FieldTypeRequiredDescription
symbolstringYesTrading pair
sidestringYesBUY / SELL
pricestringYesNew price
quantitystringYesNew quantity
cancelOrderIdlongOne of the twoorderId of the order to cancel
cancelClientOrderIdstringOne of the twoClient-defined ID of the order to cancel
newClientOrderIdstringNoClient-defined ID of the new order, format [a-zA-Z0-9-_.], max length 100
timeInForcestringNoGTC/IOC/FOK/POST_ONLY/GTD, defaults to GTC
expireTimelongRequired for GTDExpiration timestamp (milliseconds)
selfTradePreventionModestringNoSelf-trade prevention mode
cancelReplaceModestringNoReplace mode, defaults to STOP_ON_FAILURE. See the options below

cancelReplaceMode values:

ValueDescription
STOP_ON_FAILUREIf the cancel fails, the new order is not attempted (default)
ALLOW_FAILUREThe new order is attempted even if the cancel fails
PLACED_THEN_CANCELThe old order is cancelled only after the new order is placed successfully

On success, data is the new order information (a single object); on failure, data is an error object {code, msg}.