sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
5.88k stars 2.2k forks source link

Close all orders if one fails #1369

Open ahmedzzabdalla0 opened 8 months ago

ahmedzzabdalla0 commented 8 months ago

If I am going to request a group of orders and an error occurs in one of them, I want it to stop and delete any previous order that was executed. I'm wondering if there is an official way on Binance to do this

Instead of using try and except then delete one by one, an error may also occur due to deletion

dhyanKaro commented 8 months ago

You can make a wrapper function which records the order id of each order placed if it was successful or not, then if it wasn't, break and start cancelling them all.