I’ve been working on this open source crypto trading bot in Python for the past few weeks, and I have to say that testing and optimising this particular strategy has proven to be more challenging than some of my previous crypto trading algorithms.
In case you’re new to the project, I’ve recently build a crypto trading algorithm that detects new coin listings on Binance and automatically places buy and sell orders on them in a matter of seconds.
I also made a video of it, which explains the whole thing:
How I improved the trading algorithm:
The last few weeks testing this strategy have been a bit of pain due to the nature of the testing process. Every time I would start the algorithm, I would have to wait there for days at a time before it does anything. Finally, Binance decides to list a new coin, and the script just breaks.
No problem, let’s go in and fix the code. Note that during the first iteration of the tool the trading bot is able to detect a new coin on Binance within 20 seconds of it being listed. It became apparent that the code is too slow, so I started working on the speed.
New coins trading bot v2 – 5 seconds
With some of the bugs (hopefully) fixed and new reaction speed of just 5 seconds, it was time to test this again. Binance lists a new coin and the script breaks again…
Repeat this process a few times over, it was required heaps of patience but I did it. The script is now functional (with some minor bugs that I will fix in the coming days).
New coins trading bot v3 – 0.2 seconds
This is where things get exciting. Along with several bugfixes, I have made some significant speed improvements, and with the help of Reddit user steks13, the script was now able to buy a new coin within 0.2 seconds of it being listed on Binance.
Moment of truth
I, once again let the script loose on Binance, and surely enough Binance has listed a new coin – GNO.
The algorithm detected GNO as a new listing at 6:00AM UTC, and placed a buy order at 6:00.02. It placed the order at 394 USDT and eventually GNO peaked at $418, although the listed price was closer to $300.
Looks like even 0.2 seconds in speed is still too slow to take advantage of the initial Binance listing pump. Some new speed improvements are needed.
The trading bot ended up selling at 3% loss – which might not seem like an achievement, but I am personally very happy with the fact that it actually works, and this gives me a good base to make the necessary improvements in order to optimise this strategy.
Going forward
While this is not an overwhelming result in itself, it gives me a good idea on how to turn this strategy profitable. There are two strategies that I will be testing to be more exact:
- Improve the speed to a minimum of 0.1s from when a coin is listed. And this here is a hard cap. We cannot call the Binance API any faster without incurring an IP ban.
- Place sell orders instead. If we’re detecting a coin at its local peak that doesn’t mean there’s no profit to be made. Simply switching to margin orders may very well turn this strategy profitable.
Make sure to subscribe to the newsletter below, as well as my youtube channel so you don’t miss out future updates on this project.
Have you thought of moving your server into Tokyo AWS where the Binance servers are held?