If you’ve been following my blog, you probably know that for the past couple of months I’ve been working on an open source crypto trading algorithm that can detect and instantly place trades on Binance new coin listings. The main issue has been speed of execution, or more specifically how long it takes the algorithm to detect a new listing on Binance and place a buy order. So I have decided to remove the speed variable entirely, by going about it a different way – and it involves the Gate.io API.
You can check out the video here or follow along with the article below:
Before we jump into it, I’m excited to announce that I’m working on an NFT project on the Solana blockchain! Join the Discord here to find out more if you’re into this kind of thing.
Quick breakdown on the Binance new coins trading bot
Before I go explaining the new crypto trading bot that I’ve built. here’s a quick rundown on how this project has evolved:
- Iteration 1: trading bot can detect new coins on Binance and place trades within 20 seconds
- Iteration 2: trading bot can detect new coins on Binance and place trades within 5 seconds
- Iteration 4: trading bot can now place trades within 0.1 seconds of a new coin being listed on Binance
- Iteration 5: trading bot now places sell orders instead of buy orders within 0.1 seconds
Out of all the strategies tested above, Iteration 5 seemed to have the most potential. The trading bot would usually buy at the local peak upon listing (see img below) so in theory it makes sense to place sell orders instead.
Though this proved to be more difficult to transition from a test environment to a live one. The main reason behind this limitation is that Binance doesn’t list new coins for Margin and Futures trading, which means that you can’t borrow the coin in order to short it. Most new coins on Binance will only be available for SPOT trading in the very beginning, so the only way to sell the coin is to….you guessed it….own it!
Assuming you can pre-own the coin on a different exchange it’s not unreasonable to think that you could indeed short it at its peak. So in an attempt to make this strategy work, I built a crypto trading bot that sends notifications on new Binance listings. Essentially this tool will send you an e-mail notification to let you know that Binance will list a new coin soon, giving you some time to buy it on a different exchange – manually.
I tested the above strategy for a while, but as I’m not a fan of manual work, I had to come up with a way to do this efficiently and automatically. Enter Gate.io – yet another Chinese crypto exchange, one of the very first ones actually.
After speaking with a few of you on Reddit and on here, as well as doing a bit of first hand research myself, it turns out that Gate.io seems to be a bit more relaxed with the coins they list, meaning that many of the coins that Binance WILL list, are already listed on Gate.io. See where I’m going with this?
Using Gate.io and Binance to automate our crypto trading bot
We know that new coins spike in price when they get listed on Binance, but do they spike in price when they get announced for listings? Well they do!
This is the FIDA/USDT chart on CoinMarketCap. That huge increase coincides perfectly with when Binance made the announcement that they will list FIDA:
This means many people started speculating and buying up FIDA on different exchanged in anticipation for a Binance pump upon listing, and inadvertently created a pump of themselves in the process.
Ok so we know this works, all we need to do know is create a cryptocurrency trading algorithm that scans the Binance Annoucements page, and once a new coin announcement is detected, it places a Buy order on Gate.io – Should be easy enough.
I won’t go into the details of how each line of code works in this article, so make sure to subscribe to my mailing list, so you don’t miss out on the step by step guide next week. But I will go over the configuration options and how make this work on your machine.
Gate.io crypto trading bot prerequisites:
- A gate.io account (duh)
- Python 3.8+
- A Raspberry Pi / VPS/ or being ok with your Laptop or PC running 24/7
- Some knowledge of Python (highly recommended)
- Basic git skills
Getting the gate.io bot set up
Head over to GitHub and clone the repo:
Alternatively you can just manually download it:
Next you will need to head over to gate.io and create an account (you may need to KYC) and generate some API keys by navigating to your account tab.
Take note of the API key and secret, and give them permissions to read and write SPOT trades – feel free to restrict them to your own IP address for extra security.
Now open cmd/ terminal and navigate to the directory of your bot. You will need to install the requirements in requirements.txt using pip:
Now, inside your gateio trading bot directory, open the auth/auth.example.yml file and paste in your API key and Secret. Save the file as auth.yml (remove .example).
Now open config.example.yml and adjust the configuration options to suit your needs:
QUANTITY – the amount for each trade in PAIRING
PAIRING – the quoted currency of choice
TEST – enable/disable test mode. Setting this to False will use live funds to be particularly careful here and only enable at your own risk.
SL, TP – the initial stop loss an take profit values
ENABLE_TSL – enable trailing stop loss and profit functions
TSL – the trailing stop value
TTP – the trailing profit value
Save the file as config.yml
Now simply run the script using main.py and you’re all set.