← Projectswrite-up
Reddit vs. the Stock Market
A university data science group project testing whether Reddit chatter about stocks predicts their price moves.
Reddit vs. the Stock Market asks a simple question: can Reddit chatter predict stock moves? When a ticker suddenly gets talked about, or the tone around it turns positive or negative, does the price follow?
It was a group project for CSDS312 at Case Western Reserve University.
- Source code: github.com/rcorrie325/Reddit-Stock-Data
The data
- Reddit: 10,261 top posts from 13 investing subreddits (r/wallstreetbets, r/stocks, r/investing and others), from April to December 2024, collected with PRAW, Reddit's Python API wrapper.
- Prices: daily open, high, low, close and volume for 2024 for about 340 tickers, from the Polygon.io API.
The approach
- Find ticker mentions. Each post is scanned for the tickers in our stock list, so every post can be tied to the companies it discusses.
- Score sentiment. Post text is scored with the Hedonometer word list, which gives each word a happiness rating. Separately, a 7-day rolling TextBlob sentiment score is plotted against the 7-day market return.
- Test for a relationship. Simple linear regressions check whether a stock's price change can be explained by the sentiment of the posts about it and by how often it was mentioned.
Tech stack
- Python: pandas, PRAW, requests, TextBlob, matplotlib
- R: tidytext, dplyr (R Markdown)
- Jupyter notebooks for the Reddit data collection