Cryptocurrency Sentiment Analysis With RedditExtractoR

Determining your next cryptocurrency investment is on us!

Prelude

As you might be knowing, supply and demand is what largely drives the value of a cryptocurrency. In other words, the more popular the cryptocurrency is, the more likely it is to rise in value. The purpose of this project is to perform a sentiment analysis on the data available on the subreddits of various cryptocurrencies to determine which option would be our best bet.

We will be using the RedditExtractoR and Sentiment Analysis packages for the sake of completing this project.

There is a high chance that these packages won’t be preinstalled on your console, and in that case you will have to install them first.

The names of these libraries are self explanatory.

PackageDescription
RedditExtractoRThis package can be used to extract data from Reddit and construct structured datasets.
Sentiment AnalysisPerforms a sentiment analysis of textual contents in R.
QDAPUsed for computer assisted qualitative data analysis.

The Code

library(RedditExtractoR)
doge<- get_reddit( subreddit="dogecoin",page_threshold= 5,sort_by ="comments") #storing the data we get from the subreddit in the variable doge
library (SentimentAnalysis)
sentiment<- analyzeSentiment(doge$comment) #storing the result of our sentiment analysis on a variable sentiment
sentiment$SentimentQDAP #utilising the functionality of the QDAP package to assign scores
countWords(doge$comment,removeStopwords=FALSE)
write.csv(doge,"c:/Users/xyz/Downloads/doge.csv") #storing the data in a csv file
write.csv(sentiment,"c:/Users/xyz/Downloads/dogesentiment.csv") # storing data in csv file

The CSV files need to be created prior to the execution of the code and their file path entered in the correct format. You can read about the parameters of get_reddit function from here. You can modify the code to perform sentiment analysis on the subreddits of at least 4-5 cryptocurrencies that you are looking forward to invest in. Executing this code would give you simple CSV fileswhich you can access using Excel. Taking out the average of the values associated with the columns (in dogesentiment.csv) with something to do with positivity and comparing the same score among various cryptocurrencies can give you an acute idea on which cryptocurrency has the most positive outlook and hence would be the better investment. All crypto wallets have some sort of visualization tools that help you take a look at the growth trajectory on hourly/daily/weekly/monthly/yearly basis ,but by analyzing prior data no one could have predicted what happened to GameStop and what is happening now with Dogecoin and hence this project might come in handy to help you decide your next investment. It is possible to wrap up the project in R itself without using Excel or any such similar tool and you will be able to do so yourself as you progress in the course.