Cancel All Orders
Submits a cancel request for all open orders of an account.
Optionally the user can specify a list of ids representing order ids or a list of client_ids, and an instrument_code, as query parameters:
instrument_codealone cancels every open order on that instrument.idscancels those orders, regardless of the market they belong to. Withinstrument_code, only those orders on that instrument are cancelled.client_idscancels those orders and requiresinstrument_code: a client id is unique per instrument, not per account, so every listed client id must be on that instrument. To cancel by client id on several instruments, send one request per instrument.
Calling this endpoint without any of the optional parameters will cancel all orders across all markets for the account. Calling it with both ids and client_ids is not supported.
Tip: One Trading will always fill orders with best effort. Therefore, when attempting to close all orders, these orders may be in the process of being filled. In this case, One Trading will attempt to close the orders but the order may already be partially/fully filled. Make sure to have a valid API key with the scope TRADE, otherwise this operation will be rejected. This endpoint is not rate-limited.
Response
The response lists the cancellations the exchange confirmed within a short window, not every order submitted for cancellation:
- Without parameters or with only
instrument_code, it contains the order ids confirmed within about 100 ms. A successful request can therefore return a partial or empty list; useGET /v1/account/ordersto check what remains open. - With
ids, it contains the order ids confirmed within 2 seconds. IDs of orders that do not exist are skipped. - With
client_ids, it contains the client ids (not order ids) confirmed within 2 seconds.
ids and client_ids must be wrapped in square brackets, e.g. [id1,id2].
bearerAuthAuthorizationBearer <token>API key created in the One Trading UI, sent as Authorization: Bearer <token>. Each endpoint lists the key permission it needs.
instrument_code?stringThe instrument to cancel orders on. On its own, cancels every open order on the instrument; with ids, narrows the cancel to those orders on the instrument. Required with client_ids.
ids?stringArray of comma separated order ids to cancel orders for
client_ids?stringArray of comma separated client ids to cancel orders for, all on instrument_code (required with this parameter)
OK
application/json- response
[index: integer]?stringOrder ids (or client ids when cancelling by client_ids) whose cancellation the exchange confirmed within the response window
uuidcurl -X DELETE 'https://api.onetrading.com/fast/v1/account/orders?instrument_code=BTC_EUR&ids=%5Bd1efc79d-f78d-4a9d-a4c0-dbe76c9a4e6f%2C8ada8f2d-56ea-4b24-bfd4-06723dfbb3be%5D&client_ids=%5Bd1efc79d-f78d-4a9d-a4c0-dbe76c9a4e6f%2C8ada8f2d-56ea-4b24-bfd4-06723dfbb3be%5D'[ "7749a0ff-9a5f-41ac-a1a5-dc031a70091c", "737f07d9-1711-49d0-a834-80b88329c101"]