This repository provides an interactive web application built with Streamlit for performing sentiment analysis on stock news articles. The app analyzes news articles related to selected stock tickers and assesses sentiment using the FinBERT model for financial news sentiment analysis.
- Search for News Articles: Search for stock news articles by stock ticker and date.
- Sentiment Analysis: Perform sentiment analysis on the articles to classify them as positive, negative, or neutral.
- Visualization: Display sentiment distribution and sentiment scores for the selected stock tickers.
- Python
- Streamlit: For the interactive user interface.
- FinBERT: A transformer model for sentiment analysis on financial texts.
- BeautifulSoup: For scraping news articles from Business Insider.
- Matplotlib & Seaborn: For visualizing sentiment distribution and sentiment scores.
- YFinance: For fetching stock ticker information.
- Pandas: For data manipulation and processing.
- Requests: For making HTTP requests to fetch articles.
- Torch: For model loading and processing.
-
Clone the repository:
git clone https://github.com/yourusername/stock-news-sentiment-analysis.git
-
Navigate into the project directory:
cd stock-news-sentiment-analysis -
Install the required dependencies:
pip install -r requirements.txt
-
Run the Streamlit app:
streamlit run app.py
-
Open your browser and go to
http://localhost:8501to start using the Stock News Sentiment Analysis tool.
app.py: Main application file that runs the Streamlit app, handles user input, and displays results.sentiment_analyzer.py: Contains the sentiment analysis model loading and prediction functions using FinBERT.visualizations.py: Functions for visualizing sentiment distribution and sentiment scores.newsscraper.py: Functions for scraping news articles related to stock tickers from Business Insider.requirements.txt: List of required Python libraries for this project.README.md: Documentation for the repository.
- Ticker Selection: Users can input stock tickers and add them to the list of tickers to track.
- Search News: After selecting a date, the app searches for news articles related to the selected tickers and date.
- Sentiment Analysis: Each article is analyzed for sentiment using the FinBERT model, which classifies the article as positive, negative, or neutral.
- Visualization:
- Sentiment Distribution: A bar chart displaying the sentiment distribution for each stock ticker.
- Sentiment Scores: A bar chart displaying the sentiment scores of the top articles for each ticker.
- Input stock tickers such as
AAPL,TSLA, orGOOG. - Select a target date for the news search.
- Click Search News to retrieve news articles for the selected tickers and date.
- View the sentiment analysis results and visualizations for the selected tickers.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to fork this repository and submit pull requests for improvements or fixes. If you encounter any issues, please open an issue in the repository.
Made with ❤️ by CyberRik