A web application that analyzes Reddit sentiment and stock data for any given stock symbol. It fetches posts and comments from multiple subreddits, performs sentiment analysis using TextBlob, and visualizes the results with interactive charts and dashboards.
- Analyze sentiment from Reddit posts and comments
- Supports multiple subreddits:
stocks,investing,wallstreetbets,pennystocks,cryptostreetbets,options,SecurityAnalysis,StockMarket - Configurable time duration (hour, day, week, month, year, all)
- Sentiment analysis for both posts and comments
- Stock data integration (via Yahoo Finance)
- Modern, responsive dashboard UI with dark/light mode
- Visualizations: sentiment distribution, trends, post quality, and more
DEMO.mp4
- Python 3.8+
- pip
- Clone the repository:
git clone https://github.com/yourusername/reddit-stock-sentiment.git cd reddit-stock-sentiment/stock - Install dependencies:
pip3 install -r requirements.txt
- Set up Reddit API credentials:
- Create a Reddit app at https://www.reddit.com/prefs/apps
- Add the following to your
.envfile:REDDIT_CLIENT_ID=your_client_id REDDIT_CLIENT_SECRET=your_client_secret REDDIT_USER_AGENT=StockAnalyzer:v1.0
- Run the application:
python3 src/app.py
- Open your browser:
- Go to http://localhost:5000
- Enter a stock symbol (e.g.,
AAPL,TSLA,PLTR), select time duration, post/comment limits, and analyze.
- Stock Symbol: The ticker to analyze (e.g.,
AAPL) - Time Duration: hour, day, week, month, year, all
- Posts Limit: Number of Reddit posts to fetch (default: 100)
- Comments per Post: Number of top comments to analyze per post (default: 10)
stock/
├── .env
├── README.md
├── requirements.txt
├── src/
│ ├── app.py
│ ├── reddit_sentiment.py
│ ├── stock_data.py
│ ├── templates/
│ │ └── index.html
│ └── visualization/
│ └── plotter.py
├── assets/
│ ├── images/
│ │ └── demo_thumbnail.png
│ └── videos/
│ └── demo.mp4
├── data/
│ └── sample_data.csv
├── tests/
│ ├── test_app.py
│ └── test_sentiment.py
├── docs/
│ └── usage.md
└── stock_sentiment.py
- The first analysis for a symbol may take longer due to Reddit API rate limits and comment fetching.
- For best results, use valid Reddit API credentials and moderate post/comment limits.
- You can customize the UI further in
src/templates/index.html.
This project is based on the original work by TiffinTech's Reddit stock analysis. I would like to thank her for making the source code available and inspiring this project.
I have made significant modifications and enhancements, including:
- Expanding data sources (more subreddits, Reddit comments, etc.)
- Adding Twitter/StockTwits integration (if applicable)
- Improving the UI/UX and dashboard features
- Making the analysis parameters configurable
- Additional bug fixes and optimizations
If you are interested in the original version, please check out her repository here.
This project is for educational and research purposes. All credit for the original concept and code structure goes to the original creator.