binance_cancel_algo_order
Cancel a working spot TWAP algo order to stop its execution and free an open-algo-order slot.
Instructions
Cancel a working spot TWAP algo order.
Calls DELETE /sapi/v1/algo/spot/order (SIGNED, IP weight 1). Pass exactly one id:
algo_id (Binance's numeric algoId) or client_algo_id (the 32-character id you
supplied when placing). Both at once is refused locally — on a destructive call an
ambiguous request is worse than a refused one.
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 algo order changes
nothing and comes back as a rejection. What it cannot undo is what already traded —
the sub-orders already filled stay filled, and only the unexecuted remainder is
called off. Read binance_get_algo_sub_orders to see what that remainder is.
When to Use:
Stopping a TWAP whose thesis no longer holds, mid-execution.
Freeing one of the 20 open-algo-order slots.
When NOT to Use:
To cancel an ordinary spot order — that is
binance_cancel_order(spot_orders.py); these endpoints do not see each other's orders.Before checking what is open —
binance_get_open_algo_ordersis free of consequence and gives you the algoId this tool needs.
Returns:
A confirmation echoing exactly the four fields Binance returned — algoId,
success, code, msg — with no claim about how much of the order had executed.
A success: false body (HTTP 200) is rendered as Error: <msg> (code <code>).
Examples: params = {"algo_id": 14511} params = {"client_algo_id": "abcdefghijklmnopqrstuvwxyz012345"}
Error Handling:
A rejection usually means the algo order is not cancellable: already finished, already
cancelled, or the id belongs to another account. -2015 means the key lacks Spot &
Margin Trading permission or this IP is not allowlisted. A 5xx/timeout leaves the
cancel UNKNOWN — re-read binance_get_open_algo_orders before assuming either way.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |