Python Trading Bot
How to List all Your Open Orders on Binance with Python
--
When running an algorithmic trading bot, there are times when it’s handy to list all your open trades. This can give you a rapid overview of your various risk factors, and your currently open commitments.
You can do this programmatically through Binance, using their advanced API. Even better, if you’re using Python, they have an official Python Library to help make life easier.
The Binance API documentation can be slightly confusing/overwhelming to work through, so I’ve extracted a few bits and pieces to construct the function below.
Update August 2023
I could never have anticipated how popular this blog, along with a YouTube channel would become.
After a listening to my readers/viewers feedback, I realized that many people were spending huge amounts of time trying to solve installation/configuration problems — rather than experiencing the joy of algorithmic trading.
I want to change this narrative — and in so doing, open up algorithmic trading for everyone.
To do this, I’ve recently launched Tradeoxy: Trading For Everyone.
If you’re reading this, Tradeoxy will simplify 90% of this series, using a series of powerful API’s and easy to use tooling.
Currently it’s in the early-access / building stage and I’d be incredibly grateful if you’d join us on this adventure. Your feedback will help us shape a better product.
Join the early access program (for free) here.
You can also view our launch video, and follow our journey on LinkedIn, Twitter, Instagram, YouTube.
Assumptions
- You’ve connected to the Binance API using an
api_key
andapi_secret_key
- You’re using the Binance Testnet as well as their live Spot trading
- You’ve received a
binance_testnet_api_key
andbinance_testnet_secret_key
- You know how to trade and the risks involved
P.S. If you’d like to see the full story on developing all the connections and keys you need in Python, check out my series “How to…