200 even when nothing was cancelled, so a 200
alone never confirms an order is off the book — you have to check the response body, and what the
body can tell you differs by route:
Cancelling asynchronously
Cancel by id is synchronous. The route waits up to 5 seconds for the matching engine to act before responding, and reportscancelled or notCancelled per order — plus a third bucket,
unconfirmed, for when the matching engine’s answer doesn’t arrive within that window.
Cancel-all, cancel-by-event and cancel-by-market are asynchronous. They return without waiting
for cancellation to complete. The unfilled amount of each order in the response’s
cancelledSubmitted list will be cancelled.
Once a cancel is sent
A cancel is queued in the matching engine and processed in sequence with the market’s other commands. Until it takes effect, the order can still fill: for example, against an order the matching engine received before the cancel. An order still in its betting delay matches when the delay elapses. Any unfilled amount is then cancelled. After a200 response, you do not need to send another cancel for:
- Cancel-all, cancel-by-event and cancel-by-market: every order in
cancelledSubmitted. - Cancel by id: orders in
unconfirmed, and orders innotCancelledwithreasonCANCEL_PENDINGorCANCEL_AFTER_MATCH. Forunconfirmed, the cancel was accepted, but confirmation did not arrive within the timeout.
cancelledSubmitted to see which orders it covers.
Choosing a route
Use cancel by id when you know what you want gone: repricing a level, pulling one side, reacting to a fill. Use cancel by market to clear one market and leave the rest of the event alone. Use cancel by event for reacting to event-level changes Use cancel-all as a circuit breaker in case everything needs to be immediately cancelled.Watching cancels land
For the asynchronous endpoints, the direct signal is theaccount:orders_v3_#{address} channel: when the
matching engine removes your order, you get an update with status: "INACTIVE" and
inactiveReason: "USER_REQUESTED".
See Real-time data and Tracking your orders.
Cancels from elsewhere
Orders sometime leave the book without you cancelling them, andinactiveReason says why. See the full table
Related
Cancel orders by id
Cancel all orders
Cancel orders by market
Cancel orders by event
Heartbeat
Arming the switch that cancels for you when your process stops.