Closed musicderp closed 3 years ago
It's been a while since I worked on this - but I don't think there are any methods for cancelling a trade. I'll add that as a feature request and hopefully have it done shortly.
So there is a way to cancel orders. I just didn't document this very well. client.open_orders
will give you an array of OpenOrder objects which are pending trades. Here's an example where I cancel all of my pending trades
open_orders = client.open_orders
for order in open_orders:
# print the order details
print(order.__dict__)
# cancel it
order.cancel()
# Refresh the portfolio
client.refresh_portfolio()
# Should return an empty array
print(client.open_orders)
I'll be working on documenting this better.
Reopening issue because the refresh_portfolio()
method is broken. Will close once I merge the fix in.
Is there any way to cancel an order through this api once it has been placed? For example, because of the delay on orders going through, some of them I may want to cancel because the price is too high