Skip to content

Commit

Permalink
Add cancel orders script
Browse files Browse the repository at this point in the history
  • Loading branch information
EmersonDove committed May 17, 2022
1 parent 6d5fa9f commit 3b29786
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/config/cancel_orders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import blankly

if __name__ == "__main__":
exchanges = [
blankly.Alpaca(),
blankly.Binance(),
blankly.CoinbasePro(),
blankly.Kucoin(),
blankly.Oanda()
]

for i in exchanges:
try:
orders = i.interface.get_open_orders()

for order in orders:
print(f"Canceling {order['id']} on {order['symbol']}")
i.interface.cancel_order(order['symbol'], order['id'])
except Exception as e:
print(e)
continue

0 comments on commit 3b29786

Please sign in to comment.