Cryptocurrency Binance trading bot that analyses Reddit sentiment

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. 

1. Authenticate:

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.

2. Configure:

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.

If you appreciate my content and would like to see more, you can support me by donating here or via the Brave Browser. This is much appreciated as it helps me to keep the content free and open source. Thank you!

6 thoughts on “Cryptocurrency Binance trading bot that analyses Reddit sentiment

  1. Fascinating stuff – I’m come into this completely new (from both a Python and crypto standpoint), but I’ve managed to bash my way through to getting this installed and running (I think). I like the challenge! 🙂

    I have three questions though, if you don’t mind?

    1. Whenever I launch the bot, the first thing that pops up is an NLTK downloader, is that normal? I just close it and the bot runs okay anyway.

    2. In the Trade Options section of config.yml, what do QUANTITY and PAIRING do? Would I need to change that?

    3. I’m testing it with a Binance account with 0.0009 XMR – is that enough to test it, and does that require any changes to the config?

    I’ve tried to give myself a crash course in this, but I learn better by doing, so I really don’t know much at the minute!

    1. Thanks, glad you find it interesting!
      1. That’s to download the missing nltk packages for sentiment analysis. Go ahead and remove nlk.download() if you’re all set up.
      2. QUANTITY tells the bot how much money to drop on each trade. For example 15 equals 15 units of your PAIRING coin. if PAIRING is USDT than the quantity will be 15 USDT/trade.
      3. Try to aim over the equivalent of $15 USDT.

      Hope this helps.

      1. Perfect, thanks Andrei! I’ve got it all up and running now, but as everything looks to be on a downer the script’s not bought anything yet.

        Just registered for updates on Mimir, best of luck with that 🙂

  2. Nice work Andrei. Thanks for this code.

    I have couple of questions:

    1 – Can the code print me what to do like “buy Ada” and not doing live trade by itself?
    In this way I can decide every-time how much to buy and to sell at each trade and whether to trust the code or not.

    2 – What does the test mode do?

    Thanks

  3. Hi I am new to this and this is an interesting project! I am currently stuck at the authentication and configuration. Is there an application that I am supposed to use or how am i supposed to download it ? Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *