binance_cancel_order
Cancel one open spot order on Binance by its order ID or client order ID. Use it to pull a resting order you no longer want, with optional restrictions to avoid cancelling an order that has started filling.
Instructions
Cancel one open spot order by id.
Calls DELETE /api/v3/order (SIGNED, IP weight 1). Pass the symbol plus exactly one
id — order_id or orig_client_order_id; both at once is rejected locally because
Binance would resolve the numeric id and ignore a mismatched client id.
Kill-switch. Refused with Error: … trading is disabled … unless the server runs
with BINANCE_ALLOW_TRADING=1.
Cancelling is idempotent in effect: a second cancel of the same order returns -2011
("unknown order") and changes nothing. What it cannot undo is a fill — use
cancel_restrictions="ONLY_NEW" to make the cancel fail rather than succeed against
an order that has already started filling.
When to Use:
To pull a resting order that is no longer wanted.
Before replacing an order, when you do not need the atomicity of
binance_cancel_replace_order.
When NOT to Use:
To cancel everything on a symbol — use
binance_cancel_all_open_orders(one call, one weight unit).To cancel one leg of an OCO/OTO list — that cancels the whole list; use
binance_cancel_order_list(order_lists.py) so the intent is explicit.
Returns:
A confirmation echoing Binance's cancelled-order object: symbol, orderId,
origClientOrderId, status (CANCELED), and the executed quantities at cancellation.
Examples: params = {"symbol": "BTCUSDT", "order_id": 123456789} params = {"symbol": "BTCUSDT", "orig_client_order_id": "my-entry-001", "cancel_restrictions": "ONLY_NEW"}
Error Handling:
-2011 means the order is not cancellable: it does not exist, already filled, was
already cancelled — or cancel_restrictions did not match its current state, which is
the safe outcome, not a failure. A 5xx/timeout leaves the cancel UNKNOWN: check with
binance_get_order before assuming the order is still live.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |