CyberPunkMetalHead / binance-trading-bot-new-coins

This Binance trading bot detects new coins as soon as they are listed on the Binance exchange and automatically places sell and buy orders. It comes with trailing stop loss and other features. If you like this project please consider donating via Brave.
MIT License
1.46k stars 269 forks source link

Added multithreading. #16

Closed stevenhgs closed 2 years ago

stevenhgs commented 2 years ago

When executing the code I saw that the time between each loop was caused by the get_all_coins method. So all the time got lost on getting the info from Binance. So my new solution makes a new thread every 0.05 seconds which makes a request to get all the coins. The responses of these requests will be added on a queue. Every time the queue is not empty the new data will get taken from the queue and it will get checked if there are new coins.

So now every 0.05 seconds there is a check if there is a new coin listed on Binance. This should be within the limits of the Binance API.

PS: I had to make changes to the binance_auth.py file because this gave me errors, feel free to edit my changes.

CyberPunkMetalHead commented 2 years ago

Thanks @stevenhgs , looks good to me!