I built this crypto trading bot for fun, but as I kept adding features to it, I couldn’t help but make it more robust than I initially planned for, it’s like a high-effort meme with all the bells and whistles.
If reading reddit posts counts as doing your own research, well why not automate this process by building a crypto trading algorithm that takes into account the sentiment of trending Reddit posts on cryptocurrency subs. It’s like your Reddit ghost doing the hard work for you, so you can have even more time to constantly check your portfolio.
Think about it this way, if you lose money – you’ll do it more efficiently as it saves you time (bonus: it also prologues your scroll-wheel life). If this strategy makes you money, you can thank the Reddit hive-mind for upvoting good quality content. It comes with a test mode, so don’t worry.
Amidst the memes, shills and moons-farming is where insight lives, and that’s exactly what this trading algorithm aims to do – look for relevant content in hot, determine the sentiment of the title and body, and, if positive buy the coin mentioned in the post. Let’s get to it.
Stuff you’ll need:
- a Binance account
- a Reddit account
- some knowledge of Python
Create a Binance account
If you don’t have a Binance account, or would like to create a separate account to run the bot on, go ahead and create one. You can use my referral link to get 5% off your trading fees. Once you’re all set-up on Binance, go Account > API Management and generate an API key and secret and save the keys somewhere.
Create a Reddit app
The bot uses the Reddit API to look for posts, so you’ll need to create a personal app. To do that go here, scroll down and click on create app. Give your app a name, and configure it as shown below:
Note down the credentials in red, you’ll need them to authenticate and connect to your app. I’ve replaced the keys below with the corresponding variable names in the Reddit client.
Configure the script
The first thing you want to do is to download the Reddit sentiment crypto trading bot from the GitHub Repository. Make sure to star the repo to follow any updates to the bot. I’ll first run through the authentication and configuration options as well as how to run the bot.
Open auth/auth.example.yml and authenticate with the Reddit and Binance clients. Note that in addition to the client id, client secret and user agent, you will also need to provide our username and password. Remove .example and save the file as auth.yml. We’ll access the Reddit API through the praw library.
Open config.yml and set your desired configuration. Each line has comments so it should be quite clear what each options does. By default we have:
Lastly, open keywords.yml and define the keywords the reddit trading bot should look for like so. Each new set of keywords needs to live under the correct coin symbol as seen on exchanges in order for the trades to fire correctly.
Install requirements and run the script
In your cmd/ terminal you have two ways you can go about it:
The easy way:
The preferred way:
All that’s left now is to run the reddit_crypto_trader.py and that’s it – you script should now be executing.
Did you enjoy this article? Subscribe for more awesome content and updates on this project.
Next week we’ll go deep-diving into the actual code behind this bot.