← Projectswrite-up

Reddit vs. the Stock Market

A university data science group project testing whether Reddit chatter about stocks predicts their price moves.

ravicorrie.com/projects/reddit-stock-datawrite-up
Type
write-up
Source
github.com/rcorrie325/Reddit-Stock-Data
Stack
python · data-science · sentiment-analysis
Likes
0

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.

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

  1. 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.
  2. 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.
  3. 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

Comments (0)

Log in or sign up to comment.