I configured a crypto trading bot to buy crypto based on Reddit post sentiment from relevant subreddits, it's running right now and just bought me Bitcoin. The code is open-sourced.

I mainly built this for fun, and as a coding challenge, as I'm not sure how viable it would be to base my investing decisions based on the Reddit hive-mind. But having said that, I will test the tool out and see what it can do - who knows, maybe among all the shills and moon-farmers is where insight truly lives.​Here's a little bit about how it works:It's a trading bot that analyses reddit post sentiment and automatically buys the coins mentioned in the post. So it checks if the post title and body talk positively about x coin, and if that's the case it goes ham on that coin.But it only does this for coins I tell it to look out for: by default it will only check BTC and ETH but you can add any number of keywords. This is built in to discourage shill exploits.​It also comes with several customisation options so you can choose how you want to use this:Which subreddits it should look for (by default it checks r/Cryptocurrency and a couple others)How to sort posts (hot by default)How many posts from each sub will be analysed (by default 10)What keywords it should be looking out for (default: Bitcoin and Ethereum)​You can also specify how often to check for posts, as well as the size of each trade placed.I added a test mode so it can just simulate trades, so you can see how it would work in a live market, but without using real funds.​I just let it run in test mode now and here's the output:New posts detected, fetching new posts...Found matching keywords with the following sentiments: {'BTC': 0.01482083333333333, 'ADA': 0.0}BTC sentiment is positive: 0.01482083333333333, preparing to buy...PLACING TEST ORDEROrder created with 0.000439 on BTCSentiment for ADA is negative or ADA is currently in portfolioHere's my test order stored locally so that I can track the results. It bought Bitcoin hah.{"BTC": {"symbol": "BTCUSDT","price": "34170.99000000","volume": 0.000439,"time": 1624904258.977829}}You can also change the pairing to something other than USDT ;)​And here's an example of how posts are being stored:{"title": "SafeDollar \u2018stablecoin\u2019 drops to $0 following $248 million DeFi exploit on Polygon", "subreddit": "Cryptocurrency", "body": ""},It has no body as it's a link. Though you can see that it ignored SafeDollar and only picked BTC and ADA as these are two of the keywords I have chosen for it.​The bot will also stop from buying or analysing posts while the same posts are in top/hot, to avoid re-buying on the same signal.​Here's the GitHub repo for the project:https://ift.tt/3djMzax I also made a guide on how to set this up and get it running if you need more info:https://ift.tt/3y4US29

Submitted June 29, 2021 at 01:29AM

No comments:

Post a Comment