Cancelling an order
In this chapter you will learn how to cancel orders and how to handle errors.
Cancelling an order
You can only cancel MARKET
orders if they have the status NEW
.
LIMIT
orders can be cancelled up to thePROCESSING
state.STOP
orders can be cancelled before the stop-price has been reached in thePROCESSING
state.
To cancel an existing order, call the cancellation endpoint with the appropriate order ID, using
DELETE /orders/{order_id}
Handling errors
The Investment API will only return synchronous errors on order creation in two scenarios: either the request is malformed or the values provided are valid but unprocessable. The later case will occur if the account ID does not exist in the system yet.
- HTTP
400 Bad request
- HTTP
422 Unprocessable entity
Other errors that can happen in order processing are asynchronous and will be represented by a state change to CANCELLED
and will have a descriptive error message.
Detailed enumeration of error messages will follow soon in the next iteration of the guide.
Was this page helpful?
On This Page