alpaca-trade-api-python
alpaca-trade-api-python copied to clipboard
[Bug]: cancel_all_orders method does not work
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
When I call api.cancel_all_orders() I check my account from the UI and open orders remain open.
Expected Behavior
All orders should be closed.
Steps To Reproduce
No response
Anything else?
No response
Hey @albertsalgueda sorry for the delay on this one; does this only happen when using the python SDK? We simply make a DELETE call to the endpoint, so I think this might've been a bug with the API itself.
Is it still happening now ? :thinking:
@albertsalgueda
I think the problem is that you are trying to cancel the orders on extended hours.
If you go to the web interface, you will see the status pending_cancel
Right?
if that is the case, here is the explanation from Alpaca
The primary reason one sees pending cancel orders is when an order is cancelled during non-market hours. Alpaca forwards the request to the execution partner who has the order, but many of these partners only accept orders and cancelations during market hours or at most limited hours. Orders cancelled after market hours therefore often remain in a pending cancel state until the following market open.