v26

latestOpenAPI 3.0.2raw.githubusercontent.com2024-10-0834042975.6 KB
Trade

Cancel an Existing Order and Send a New Order (Trade)

Cancels an existing order and places a new order on the same symbol.

Filters and Order Count are evaluated before the processing of the cancellation and order placement occurs.

A new order that was not attempted (i.e. when newOrderResult: NOT_ATTEMPTED), will still increase the order count by 1.

Weight(IP): 1

post/api/v3/order/cancelReplace

Query parameters

symbolstring required
Example:BNBUSDT

Trading symbol, e.g. BNBUSDT

side'SELL' | 'BUY' required
Example:SELL
type'LIMIT' | 'MARKET' | 'STOP_LOSS' | 'STOP_LOSS_LIMIT' | 'TAKE_PROFIT' | 'TAKE_PROFIT_LIMIT' | 'LIMIT_MAKER' required
Example:LIMIT

Order type

cancelReplaceModestring required
Example:STOP_ON_FAILURE
  • STOP_ON_FAILURE If the cancel request fails, the new order placement will not be attempted.
  • ALLOW_FAILURES If new order placement will be attempted even if cancel request fails.
cancelRestrictions'ONLY_NEW' | 'ONLY_PARTIALLY_FILLED'
Example:ONLY_NEW
timeInForce'GTC' | 'IOC' | 'FOK'
Example:GTC

Order time in force

quantitynumber double
Example:1

Order quantity

quoteOrderQtynumber double

Quote quantity

pricenumber double
Example:219

Order price

cancelNewClientOrderIdstring

Used to uniquely identify this cancel. Automatically generated by default

cancelOrigClientOrderIdstring

Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence.

cancelOrderIdinteger
Example:12

Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence.

newClientOrderIdstring

Used to uniquely identify this cancel. Automatically generated by default

strategyIdinteger
strategyTypeinteger

The value cannot be less than 1000000.

stopPricenumber double
Example:221.01

Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.

trailingDeltanumber double

Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.

icebergQtynumber double

Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.

newOrderRespType'ACK' | 'RESULT' | 'FULL'

Set the response JSON. MARKET and LIMIT order types default to FULL, all other orders default to ACK.

selfTradePreventionMode'EXPIRE_TAKER' | 'EXPIRE_MAKER' | 'EXPIRE_BOTH' | 'NONE'
Example:EXPIRE_TAKER

The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE.

recvWindowinteger
Example:5000

The value cannot be greater than 60000

timestampinteger required

UTC timestamp in ms

signaturestring required

Signature

Response

Operation details

cancelResultstring required
newOrderResultstring required

Example response

{
  "cancelResult": "SUCCESS",
  "newOrderResult": "SUCCESS",
  "cancelResponse": {
    "symbol": "BTCUSDT",
    "origClientOrderId": "DnLo3vTAQcjha43lAZhZ0y",
    "orderId": 9,
    "orderListId": -1,
    "clientOrderId": "osxN3JXAtJvKvCqGeMWMVR",
    "price": "0.01000000",
    "origQty": "0.000100",
    "executedQty": "0.00000000",
    "cummulativeQuoteQty": "0.00000000",
    "status": "CANCELED",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "SELL",
    "selfTradePreventionMode": "NONE",
    "transactTime": 1507725176595
  },
  "newOrderResponse": {
    "symbol": "BTCUSDT",
    "orderId": 10,
    "orderListId": -1,
    "clientOrderId": "wOceeeOzNORyLiQfw7jd8S",
    "transactTime": 1652928801803,
    "price": "0.02000000",
    "origQty": "0.040000",
    "executedQty": "0.00000000",
    "cummulativeQuoteQty": "0.00000000",
    "status": "NEW",
    "timeInForce": "GTC",
    "type": "LIMIT",
    "side": "BUY",
    "workingTime": 1669277163808,
    "selfTradePreventionMode": "NONE"
  }
}