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 ConneX submits the change to the exchange, then action: "AMEND_COMPLETED" (or "AMEND_FAILED") once the exchange confirms.

Tip:
You can create order by websocket after login.

📘

This action runs over the User Data WebSocket connection at wwss://wss.connex.trade/v1/private. The server rejects everything until you send a login message, and drops the connection after 30 seconds of inactivity — see Overview for the login payload, signature and heartbeat.

Rate Limit

The limits below apply to this operation. Binance perpetual, Binance spot and margin combined, and OKX across all business lines are counted separately.

main portfolio:

Binance (all business lines)

  • Rate Limit: 300 requests per 60 seconds.

OKX (all business lines)

  • Rate Limit: 300 requests per 60 seconds.

sub portfolio:

Binance perpetual

  • Rate Limit: 20 requests per 10 seconds.

Binance spot and margin

  • Rate Limit: 20 requests per 10 seconds.

OKX (all business lines)

  • Rate Limit: 20 requests per 10 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 nameTypeNecessaryRemarks
idStringNclient request id
actionStringYMust be replace_order.
argsObjectYrequest params
> orderIdStringYID of the order to amend. The order must currently be in OPENor 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.
> syncModeStringNAPI synchronous validation or asynchronous validation(required "true" or "false"); default "false"

At least one of replaceQtyor replacePricemust be provided.

Response

The response is sent immediately after ConneX accepts the replace request. It does not mean the exchange has applied the change yet.

Success example:

{
  "id": "XXXX",
  "event": "replace_order",  
  "code": "200000",  
  "msg": "",
  "data": {
    "orderId": "XXXXX",
    "orderState": "XXXXX"
  }
}

Fail example:

{  
  "id":"***",
  "event": "error",  
  "code": "60009",  
  "msg": "ReplaceOrder failed."  
  }

code: 200000 means ConneX 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.


Field nameTypeRemarks
idStringclient request id
eventStringreplace_order on success, error on failure.
codeString200000 = 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).