Inspiration

GameStop Redditors(the event with GameStop and hedge funds)

What it does

This program pulls the 100 most recent reddit posts in 31 of the top stock related subreddits. Using these posts, I use a sentiment analyzer that I built for SupriseHacks but I modified to so that the sentiment would be stored in a list to see which stocks will go up or go down. The sentiment analysis is used to determine if the stock price will go up. So if someone is talking badly about a stock, it will most likely go down. The same would occur if they spoke positively. Initially I thought this would not be the case but for 3/4 of the stocks that were talked about around the time I recorded the video, this idea was true.

Note: It only predicts stocks that were actively talked about, so if someone said "tech stocks are going up" it would not think all tech related stocks will go up (This will be added later)

How we built it

I first grabbed my sentiment analyzer from my SupriseHacks entry, and I modified it and put it into a predict_stocks function. After that I learned how to get subreddit posts. I created the methods to grab and store those posts. Then I separated these posts depending on if the sentiment was positive or negative. While separating these posts I would print whether or not the sentiment analysis thinks that the stock price will increase or decrease.

Challenges we ran into

-Trying to pull Reddit posts down (I first tried using BeautifulSoup but then realized their is a python module known as praw)

-trying to make the program run faster (added threads to fix this)

Accomplishments that we're proud of

-Getting the program to work

-Seeing that posts on reddit correlate with how stock prices increase or decrease

-learning a new python module and using it effectively

What we learned

-That the posts on reddit correlate with how the stock prices behave. The more positive a comment was about a stock, the higher the price turned out to be and same for the negativity.

-I also learned about the praw python module. This module saved time trying to scrape just the posts from the subreddits.

-That what people say matters

What's next for Reddit Stock Predictor

I want to optimize the code. Right now the predict_stocks function uses 2 for loops which is an O(n^2) solution. I want to try and make it an O(n) solution. And I want to improve the threading logic to make the program run faster. Right now I have new threads created for each subreddit. I want to try and combine smaller subreddits into a single thread. Lastly, the find stock method does not work. the program is fully functional besides that part. Once that part is done then the program will be exactly how I imagined it.

I will also try to incorporate other communication platforms to see if the general public can sway the stock market.

Important Note

If you like this idea please star the repository( Judges and participants) so that more people can become aware of it and can contribute to improve it.

Built With

Share this project:

Updates