Skip to content

ibitec7/stock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

36 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NVIDIA Stock Analysis Dashboard πŸ“ˆ

A comprehensive stock analysis dashboard for NVIDIA (NVDA) that combines market data, news sentiment analysis, and technical indicators to provide deep insights into stock performance. This project leverages machine learning models for sentiment analysis, custom technical indicators from PyPI, and interactive visualizations to help understand the relationship between news sentiment and stock price movements.

Overview

This dashboard analyzes NVIDIA stock by integrating multiple data sources:

  • Market Data: Real-time and historical stock prices sourced from Yahoo Finance
  • News Data: Over 7,000+ news articles collected over 10 years
  • Technical Indicators: Custom indicators calculated using the indicators-cli package
  • Sentiment Analysis: Advanced sentiment analysis using FinBERT and VADER models
  • LLM Analysis: AI-powered market analysis and trading recommendations

The application features interactive Plotly charts, customizable timeframes, buy/sell signal analysis, and hypothetical trade analysis including dollar-cost averaging and lump-sum investment scenarios.


Repository Structure

πŸ“‚ Directories

  • dashboard/ - Streamlit dashboard application files

    • Main dashboard interface with multiple tabs for different analyses
    • Helper functions for data processing and visualization
    • Individual tab modules for organized functionality
  • src/ - Source code for data collection and processing

    • News fetching and scraping utilities
    • Sentiment analysis scripts using FinBERT and VADER
    • LLM integration for market analysis
    • Data cleaning and preprocessing tools
  • data/ - Historical stock and news data storage

    • Contains yearly subdirectories (2020-2025) with news JSON files
    • Stock price CSV files for different time periods
    • Processed data for events and sentiment analysis
  • cache/ - Cached data for performance optimization

    • Indicators data in Parquet format
    • Processed sentiment and analysis results
    • Configuration files for indicators
  • plots/ - Generated visualizations and charts

  • new_data/ - Additional news data organized by year

πŸ“„ Key Files

  • dashboard/dashboard.py - Main Streamlit dashboard application with modular tabs
  • dashboard/dashboard_complete.py - Standalone complete dashboard version
  • dashboard/my_dashboard.py - Alternative dashboard implementation
  • dashboard/dashboard_helpers.py - Utility functions for data loading and processing
  • dashboard/tab1.py - Stock Overview tab with price charts and indicators
  • dashboard/tab2.py - News Sentiment analysis tab
  • dashboard/tab3.py - Technical Indicators detailed analysis
  • dashboard/tab4.py - Correlation Analysis between sentiment and price
  • dashboard/tab5.py - Insights & Findings with key takeaways
  • dashboard/events.py - Event detection and analysis
  • src/news.py - News fetching script using News API
  • src/sentiment.py - Sentiment analysis using FinBERT and VADER
  • src/llm.py - LLM-based market analysis using Ollama
  • src/corpus.py - Text corpus generation for NLP analysis
  • src/clean.py - Data cleaning and validation utilities
  • src/events.py - Event extraction from news articles
  • requirements.txt - Python package dependencies
  • LICENSE - MIT License

πŸš€ Getting Started

Prerequisites

  • Python 3.8 or higher
  • Git
  • CUDA-capable GPU (optional, for faster sentiment analysis)
  • News API key (for fetching news data)

Installation

  1. Clone the repository

    git clone https://github.com/ibitec7/stock.git
    cd stock
  2. Install dependencies

    pip install -r requirements.txt
  3. Install the indicators-cli package

    pip install indicators-cli
  4. Download required NLTK data

    python -c "import nltk; nltk.download('vader_lexicon')"

Running the Dashboard

Navigate to the dashboard directory and run the Streamlit application:

cd dashboard
streamlit run dashboard.py

The dashboard will open in your default web browser at http://localhost:8501.

Alternative Dashboard Versions

You can also run the complete standalone version:

streamlit run dashboard_complete.py

Or the alternative implementation:

streamlit run my_dashboard.py

🎯 Features & Components

1. Stock Overview Tab

  • Interactive Price Charts: Candlestick, Line, and OHLC chart types
  • Timeframe Selection: Choose from daily, weekly, monthly, or quarterly data
  • Period Options: YTD, 1Y, 2Y, 5Y, 10Y, or all-time data
  • Date Range Filters: Custom start and end dates
  • Refresh Market Data: Button to fetch the latest market data from Yahoo Finance
  • Volume Analysis: Trading volume visualization
  • Key Metrics Display: Current price, change, and percentage change

2. News Sentiment Tab

  • Sentiment Distribution: Visual representation of positive, neutral, and negative news
  • Daily Sentiment Trends: Time-series analysis of sentiment scores
  • FinBERT Sentiment Analysis: Advanced financial sentiment using pre-trained models
  • VADER Sentiment Scores: Compound sentiment scores for articles
  • Recent News Display: Latest headlines with sentiment indicators
  • Sentiment Clustering: K-Means clustering of news embeddings to identify sentiment groups
  • News Article Count: Track news volume over time

3. Technical Indicators Tab

  • Moving Averages: SMA, EMA with customizable periods
  • Momentum Indicators: RSI, MACD, Stochastic Oscillator
  • Volume Indicators: On-Balance Volume (OBV), Volume Moving Average
  • Trend Analysis: Identify bullish and bearish trends
  • Buy/Sell Signals: Automated signal generation based on indicator crossovers
  • Custom Indicator Configuration: Upload custom indicator configurations
  • Multi-timeframe Analysis: View indicators across different timeframes

4. Correlation Analysis Tab

  • Sentiment-Price Correlation: Correlation matrix between sentiment scores and price movements
  • Lagged Effects Analysis: Examine how sentiment affects price with time delays
  • Heatmap Visualization: Interactive correlation heatmaps
  • Statistical Significance: P-values and confidence intervals
  • Feature Correlation: Correlate technical indicators with sentiment scores

5. Insights & Findings Tab

  • Key Takeaways: Summarized insights from the analysis
  • LLM-Generated Analysis: AI-powered market analysis and recommendations
  • Trading Strategy Recommendations: Data-driven buy/hold/sell suggestions
  • Risk Assessment: Market risk factors and monitoring points
  • Trend Predictions: Short-term and long-term trend forecasts
  • Event Impact Analysis: How major events affected stock prices

6. Investment Analysis Features

  • Dollar-Cost Averaging (DCA): Analyze periodic investment strategies
  • Lump-Sum Investment: Compare one-time investment scenarios
  • Returns Calculator: Calculate historical returns for different strategies
  • What-If Analysis: Hypothetical investment scenarios

7. Data Processing Pipeline

  • Indicators-CLI Integration: Custom PyPI package for technical indicators
    • Fetches market data from yfinance
    • Calculates indicators using Polars (CPU/GPU support)
    • Outputs data in efficient Parquet format
  • News Data Collection:
    • Over 7,000+ news articles spanning 10 years (2015-2025)
    • Monthly news aggregation
    • Article content scraping using Selenium and BeautifulSoup
  • Sentiment Analysis Pipeline:
    • FinBERT for financial sentiment classification
    • VADER for compound sentiment scores
    • Embedding generation for clustering analysis
  • LLM Analysis:
    • Ollama-based local LLM inference
    • Structured JSON output with market insights
    • Trading recommendations and risk assessment

πŸ“Š Data Sources

Market Data

  • Source: Yahoo Finance via yfinance
  • Coverage: 10+ years of historical data
  • Frequency: Daily, Weekly, Monthly, Quarterly
  • Metrics: Open, High, Low, Close, Volume, Adjusted Close

News Data

  • Source: News API and web scraping
  • Coverage: 7,000+ articles from 2015-2025
  • Processing:
    • BeautifulSoup for content extraction
    • Selenium for dynamic content
    • JSON storage with metadata

Technical Indicators

  • Source: indicators-cli (custom PyPI package)
  • Engine: Polars (with GPU acceleration support)
  • Indicators:
    • Moving Averages (SMA, EMA)
    • RSI, MACD, Bollinger Bands
    • Stochastic Oscillator
    • Volume indicators

πŸ› οΈ Technical Stack

Frontend

  • Streamlit: Interactive web application framework
  • Plotly: Interactive charts and visualizations
  • Matplotlib/Seaborn: Additional plotting capabilities

Data Processing

  • Polars: High-performance dataframe operations
  • Pandas: Data manipulation and analysis
  • NumPy: Numerical computing

Machine Learning

  • Transformers: Hugging Face library for FinBERT
  • FinBERT: Financial sentiment analysis model (ProsusAI/finbert)
  • NLTK: VADER sentiment analysis
  • scikit-learn: K-Means clustering, TF-IDF vectorization
  • PyTorch: Deep learning framework

Data Collection

  • yfinance: Yahoo Finance data fetching
  • httpx: HTTP client for API requests
  • Selenium: Web browser automation
  • BeautifulSoup: HTML parsing
  • pygooglenews: Google News integration

LLM Integration

  • Ollama: Local LLM inference
  • GPTQModel: Quantized model support
  • Optimum: Model optimization

πŸ“¦ Requirements

yfinance
polars
httpx
selenium
seaborn
matplotlib
numpy
bs4
pygooglenews
urlutils
gptqmodel
optimum
transformers
webdriver_manager
streamlit
plotly
pandas
scikit-learn
nltk
torch
indicators-cli

Install all dependencies with:

pip install -r requirements.txt

πŸ”§ Configuration

Indicators Configuration

Custom indicator configurations can be uploaded through the dashboard or placed in the cache/ directory as JSON files. Example configuration:

{
  "indicators": ["SMA", "EMA", "RSI", "MACD"],
  "periods": [20, 50, 200],
  "use_gpu": true
}

πŸ“ˆ Usage Examples

Fetching News Data

cd src
python news.py

Running Sentiment Analysis

cd src
python sentiment.py

Generating LLM Analysis

cd src
python llm.py

Running the Dashboard

cd dashboard
streamlit run dashboard.py

🎨 Dashboard Screenshots

The dashboard features five main tabs:

  1. Stock Overview - Price charts with technical indicators
  2. News Sentiment - Sentiment analysis and trends
  3. Technical Indicators - Detailed indicator analysis
  4. Correlation Analysis - Sentiment-price correlations
  5. Insights & Findings - AI-powered insights and recommendations

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.


πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Syed Ibrahim Omer (@ibitec7)


πŸ™ Acknowledgments

  • indicators-cli: Custom PyPI package for technical indicators
  • FinBERT: Pre-trained financial sentiment model by ProsusAI
  • Yahoo Finance: Market data provider
  • News API: News data aggregation service
  • Streamlit: Web application framework
  • Plotly: Interactive visualization library

πŸ“§ Contact

For questions, suggestions, or issues, please open an issue on GitHub or contact the repository owner.


πŸ”— Related Links


Note: This project is for educational and research purposes only. It should not be considered as financial advice. Always do your own research and consult with a financial advisor before making investment decisions.

About

An AI-powered stock dashboard that fuses multiple sources of data into one platform for making informed investment decisions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors