The Stock Sentiment Analysis Dashboard is a Python-based MVP that integrates real-time stock data with basic sentiment analysis of financial news headlines. The project fetches historical stock data using yfinance, retrieves news headlines via NewsAPI, performs sentiment analysis using Hugging Face's transformers pipeline, and saves the results into CSV files. A simple Streamlit dashboard is provided to visualize the data.
-
Real-Time Data Ingestion
-
Real-Time Data Ingestion: Fetch historical stock data using yfinance and financial news headlines via NewsAPI.
-
Sentiment Analysis: Perform sentiment analysis on news headlines using Hugging Face's transformers pipeline.
-
Data Integration: Combine and save the results into CSV files.
-
Interactive Dashboard: View the processed data in a simple, interactive dashboard built with Streamlit.
-
Clone the Repository:
git clone https://github.com/Triumph-KT/Stock-Sentiment-Analysis-App.git cd Stock-Sentiment-Analysis-App
-
Create and Activate a Virtual Environment (Recommended)
# Create a virtual environment named "venv" python -m venv venv # Activate it on macOS/Linux source venv/bin/activate # On Windows # venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
If no
requirements.txt
is present, install packages individually:pip install yfinance requests transformers pandas python-dotenv
For Advanced Features:
If using deep learning models (LSTM), install:pip install tensorflow keras
If fine-tuning NLP models, install:
pip install datasets transformers torch
-
Set Up Environment Variables
- Create a file named
.env
in the root directory of this project. - Add your NewsAPI key (replace
your_actual_newsapi_key
with your key):NEWSAPI_KEY=your_actual_newsapi_key
- Add any other environment variables as needed.
- Create a file named
-
Fetch Stock Data and Integrate with News
python integrated_data.py
This script fetches historical stock data (default: AAPL) using yfinance, integrates it with news sentiment analysis, and saves the combined results to CSV files.
-
View the Dashboard
Launch the Streamlit dashboard to visualize the data.streamlit run dashboard/dashboard.py
(Place the screenshot image in a folder like docs/
or images/
in your project.)
- Integrate advanced NLP techniques such as fine-tuning and aspect-based sentiment analysis.
- Develop a deep learning model for stock price prediction.
- Evolve the dashboard into a full-stack web application using React and Django/Node.js.
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes, commit, and push them.
- Open a pull request describing your changes.
This project is open source under the MIT License. Feel free to modify and use it for your own applications.