The time has come to dive once again into the Binance new coin listings, and create a tool that will automatically place an order once a new coin gets listed. I’ve been developing and testing crypto trading algorithm for over a month now and here are some of the main points:
- The algorithm’s achievable minimum speed of execution is 0.1s. Anything quicker will incur a temp IP ban from the Binance API.
- The algorithm buys at the peak of the initial listing even at 0.1s of the coin being listed – we need a different approach
- Margin sell orders work in theory, however in practice, most new coins are not immediately listed on margin/futures
With those findings in mind, I had to re-think the way the algorithm works and how it can take advantage of the price jump for initial coin listings on Binance. If you’re curious to see how the first iteration of the bot works, see this article, which explains how a Binance new listing trading bot works.
In this article, we will go over what has changed in the new iteration, how this new iteration works and how to improve our crypto trading bot further still.For now, the script for this new version lives in a separate branch in the main repo on GitHub but it will likely become a separate repo in the future as it’s quite a substantial change from the original script.
How is this crypto trading bot different?
The original tool would scan all the coins available for SPOT trading on Binance, and once a new coin has been listed it would place a buy order, within 0.1 seconds of it being listed on Binance. It would then closely follow the price change and, with the help of a trailing stop loss, would, ideally close the trade at the optimum time. Bear in mind that this entire operation would last under a second.
During my testing it turned out that the algorithm would buy at the peak of the first green candle and make a small loss. In order to go around this, the bot was then configured to place sell orders instead, in test mode. This has proven to be profitable, however there is one issue with this strategy: most coins are not available for margin or futures sell orders upon being listed.
So that leaves us with option number 3 – and the current scope for this new bot iteration.
You can also watch the video below if you prefer this format, or keep on reading!
Scraping the Binance new listing page for new coins announcements.
The first thing we want to do here is to create a scraper that will look at the Binance announcements page and pick the latest announcement. We can do this in Python using selenium. Here is the code if you want to study it in order to understand how it works. I will write a dedicated article about it next week, so make sure to subscribe to my newsletter so you don’t miss out.
For now we just want to understand how it all ties in together for the overall strategy. The scraper has some built-in logic in order to filter through different announcements and only pick the ones that are related to a new coin listing.
The script will also filter through the actual announcement and only return the symbol of the new coin listing (needed for a future upgrade).
Sending e-mail notifications when a Binance new coin listing is announced
The second important aspect of this script is to send ourselves an e-mail notification once a new coin listing announcement has been scraped. This is done by using the smtplib and ssl libraries. See source here or down below:
Here we’re sending an e-mail to our address, containing the name of the coin that will be listed in the subject line and a google search for that coin the body of the e-mail. Naturally in order to get this to work, you need to provide your Gmail credentials in the config.yml file. Use the config.example.yml to add your details in and rename it to config.yml.
See where we’re going with this yet?
How the trading bot connects to all of this
Remember we said that placing sell orders on new coins is technically profitable? The only issue is pre-owning that coin. Well this is where the scraper and notifications is making it easier for us to do that. Once you receive a notification from the bot, you would need manually buy that coin on a different exchange and send it into your Binance wallet, since we can already start depositing this coin ahead of it being listed.
Once it’s listed the bot will do its job and immediately sell the coin, for (hopefully) a nice gain.
Improving the formula
Manual work sucks, and it’s not ideal that we need to manually buy the coin ourselves, but it’s probably one of the only ways we can get this bot work and take advantage of the initial spike in the price for newly listed coins.
The next step from here is to interact with the PancakeSwap smart contact on the Binance Smart chain, and automatically buy a new coin once the announcement is in, send it to our Biannce wallet and prepare for a sell. This would come with its own set of challenges but this is what I’ll be working on for the next few weeks. So if you’re interested in this project, consider subscribing to my newsletter for more updates.