107 lines
3.2 KiB
Markdown
107 lines
3.2 KiB
Markdown
# rstat - Reddit Stock Ticker Analyzer Tool
|
|
|
|
This is a command-line tool to analyze stock ticker mentions across a predefined list of subreddits. It scrapes posts and comments, counts the number of times each ticker is mentioned, fetches the ticker's market capitalization, and will calculate a sentiment score for each mention.
|
|
|
|
## Features
|
|
|
|
* Scans a user-defined list of subreddits from a JSON configuration file.
|
|
* Identifies stock tickers (e.g., `$AAPL`, `TSLA`) in Reddit posts and comments.
|
|
* Fetches market capitalization for each identified ticker using the Yahoo Finance API.
|
|
* Summarizes the findings in a clear, command-line-based report.
|
|
* (Future) Performs sentiment analysis on each mention.
|
|
|
|
## Installation
|
|
|
|
Follow these steps to set up the project and its dependencies on your local machine.
|
|
|
|
### 1. Clone the Repository
|
|
|
|
First, clone this repository to your local machine (or simply download and create the files as described).
|
|
|
|
```bash
|
|
git clone <your-repository-url>
|
|
cd rstat
|
|
```
|
|
|
|
### 2. Set Up a Python Virtual Environment
|
|
|
|
It is highly recommended to use a virtual environment to manage project-specific dependencies, preventing conflicts with your global Python installation.
|
|
|
|
**On macOS / Linux:**
|
|
|
|
```bash
|
|
# Create a virtual environment named 'venv'
|
|
python3 -m venv venv
|
|
|
|
# Activate the virtual environment
|
|
source venv/bin/activate
|
|
```
|
|
*You will know it's active when you see `(venv)` at the beginning of your terminal prompt.*
|
|
|
|
**On Windows:**
|
|
|
|
```bash
|
|
# Create a virtual environment named 'venv'
|
|
python -m venv venv
|
|
|
|
# Activate the virtual environment
|
|
.\venv\Scripts\activate
|
|
```
|
|
*You will know it's active when you see `(venv)` at the beginning of your command prompt.*
|
|
|
|
### 3. Install Dependencies
|
|
|
|
Once your virtual environment is activated, install the required Python libraries using the `requirements.txt` file.
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Before running the tool, you need to configure the list of subreddits you want to analyze.
|
|
|
|
1. Open the `subreddits.json` file.
|
|
2. Modify the list of strings to include your desired subreddits.
|
|
|
|
**Example `subreddits.json`:**
|
|
```json
|
|
{
|
|
"subreddits": [
|
|
"wallstreetbets",
|
|
"stocks",
|
|
"investing",
|
|
"pennystocks"
|
|
]
|
|
}
|
|
```
|
|
|
|
## Usage
|
|
|
|
To run the tool, execute the `main.py` script from the root directory of the project, passing the path to your configuration file as an argument.
|
|
|
|
Make sure your virtual environment is activated before running the script.
|
|
|
|
```bash
|
|
python main.py subreddits.json
|
|
```
|
|
|
|
### Expected Output
|
|
|
|
The tool will first confirm the loaded subreddits and then proceed with its analysis, printing the results directly to the terminal.
|
|
|
|
```
|
|
Loading configuration...
|
|
Successfully loaded 4 subreddits: wallstreetbets, stocks, investing, pennystocks
|
|
------------------------------
|
|
Testing market data functionality...
|
|
Market Cap for AAPL: $2,912,488,124,416
|
|
------------------------------
|
|
Next up: Integrating the Reddit API to find tickers...
|
|
```
|
|
|
|
---
|
|
|
|
This `README.md` provides a clear and concise guide for anyone (including your future self) to get the project up and running quickly.
|
|
|
|
We are now ready to move on to the next implementation step. Shall we proceed with integrating the Reddit API using PRAW? |