Skip to content

brucegav/financial-analysis-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Financial Analysis Dashboard

A comprehensive financial portfolio analysis platform built with Python and Streamlit, featuring advanced technical indicators, risk metrics, and interactive visualizations for data-driven investment insights.

Features

Portfolio Performance Analysis

  • Real-time portfolio returns and performance metrics
  • Risk-adjusted returns (Sharpe ratio, Sortino ratio, Calmar ratio)
  • Maximum drawdown and volatility analysis
  • Value at Risk (VaR) calculations

Technical Analysis

  • Technical Indicators: RSI, MACD, Bollinger Bands, Moving Averages
  • Trading Signals: Automated buy/sell recommendations
  • Interactive Charts: Candlestick charts with volume analysis
  • Support & Resistance: Dynamic level detection

Sector Analysis

  • Performance comparison across market sectors
  • Sector rotation insights and trends
  • Risk-return profiles by industry

Correlation Analysis

  • Interactive correlation matrices
  • Portfolio diversification insights
  • Asset relationship visualization

Technology Stack

  • Python 3.8+ - Core programming language
  • Streamlit - Modern web application framework
  • Pandas - Data manipulation and analysis
  • NumPy - Numerical computing and statistical operations
  • Plotly - Interactive data visualizations
  • Historical Data - Real S&P 500 stock data from Kaggle

Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Setup Instructions

  1. Clone the repository:
git clone https://github.com/yourusername/financial-dashboard.git
cd financial-dashboard
  1. Create and activate virtual environment:
# Create virtual environment
python -m venv .venv

# Activate virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

Usage

Running the Dashboard

Start the Streamlit application:

streamlit run streamlit_app.py

Navigate to http://localhost:8501 in your web browser to access the dashboard.

Dashboard Navigation

The application features four main analysis sections:

  1. Portfolio Overview - Overall performance metrics and key statistics
  2. Technical Analysis - Individual stock technical indicators and signals
  3. Sector Analysis - Comparative sector performance analysis
  4. Correlation Matrix - Asset correlation and diversification insights

Project Structure

financial-dashboard/
├── src/                        # Core analysis modules
│   ├── __init__.py            # Package initialization
│   ├── data_collector.py      # Data loading and CSV management
│   ├── portfolio_analyzer.py  # Portfolio metrics and risk calculations
│   ├── technical_indicators.py # Technical analysis indicators
│   ├── utils.py               # Utility functions and formatters
│   └── visualizations.py     # Chart generation and plotting
├── data/                      # Historical stock data (CSV files)
│   ├── AAPL_data.csv         # Apple Inc. historical data
│   ├── GOOGL_data.csv        # Alphabet Inc. historical data
│   └── ...                   # Additional stock data files
├── streamlit_app.py          # Main dashboard application
├── app.py                    # Command-line interface
├── config.py                 # Configuration settings
├── requirements.txt          # Python dependencies
├── .gitignore               # Git ignore patterns
└── README.md                # Project documentation

Portfolio Composition

The dashboard analyzes a diversified portfolio of 16 S&P 500 stocks across four major sectors:

Technology Sector

  • AAPL - Apple Inc.
  • GOOGL - Alphabet Inc.
  • MSFT - Microsoft Corporation
  • NVDA - NVIDIA Corporation

Financial Sector

  • JPM - JPMorgan Chase & Co.
  • BAC - Bank of America Corporation
  • WFC - Wells Fargo & Company
  • GS - The Goldman Sachs Group, Inc.

Healthcare Sector

  • JNJ - Johnson & Johnson
  • PFE - Pfizer Inc.
  • UNH - UnitedHealth Group Incorporated
  • ABBV - AbbVie Inc.

Energy Sector

  • XOM - Exxon Mobil Corporation
  • CVX - Chevron Corporation
  • COP - ConocoPhillips
  • SLB - Schlumberger Limited

Key Metrics and Calculations

Portfolio Metrics

  • Total Return: Cumulative portfolio performance over selected period
  • Annualized Return: Geometric mean return scaled to annual basis
  • Volatility: Standard deviation of returns (annualized)
  • Sharpe Ratio: Risk-adjusted return metric
  • Maximum Drawdown: Largest peak-to-trough decline

Risk Metrics

  • Value at Risk (VaR): Potential loss at specified confidence level
  • Sortino Ratio: Downside risk-adjusted return
  • Calmar Ratio: Return to maximum drawdown ratio

Technical Indicators

  • RSI (Relative Strength Index): Momentum oscillator (14-period)
  • MACD: Moving Average Convergence Divergence
  • Moving Averages: 20-day and 50-day simple moving averages
  • Bollinger Bands: Volatility-based technical indicator

Data Source

The application uses historical stock data sourced from Kaggle's S&P 500 dataset, providing:

  • Daily OHLCV data: Open, High, Low, Close, Volume
  • Multi-year history: Comprehensive historical coverage
  • High data quality: Cleaned and validated stock data
  • No API dependencies: Reliable offline operation

Performance Considerations

  • Caching: Streamlit caching for improved response times
  • Data optimization: Efficient pandas operations for large datasets
  • Memory management: Optimized data structures for portfolio analysis
  • Responsive design: Works across desktop and mobile devices

Development

Code Organization

  • Modular architecture: Separated concerns across multiple modules
  • Type hints: Comprehensive type annotations for better code clarity
  • Error handling: Robust exception handling and user feedback
  • Logging: Detailed logging for debugging and monitoring

Testing

# Run data collector tests
python src/data_collector.py

# Test individual components
python -c "from src.portfolio_analyzer import PortfolioAnalyzer; print('Portfolio analyzer loaded successfully')"

Future Enhancements

  • Real-time data integration: Live market data feeds
  • Advanced portfolio optimization: Monte Carlo simulations
  • Machine learning models: Predictive analytics and forecasting
  • Additional asset classes: Bonds, commodities, and cryptocurrencies
  • Export functionality: PDF reports and data export capabilities

Contributing

This is a portfolio demonstration project. While not actively seeking contributions, feel free to:

  • Fork the repository for your own modifications
  • Submit issues for bugs or suggestions
  • Use the code as a reference for your own financial analysis projects

License

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

Contact

For questions about this project or potential opportunities, please reach out via:


Disclaimer: This dashboard is for educational and portfolio demonstration purposes only. It should not be used as the sole basis for investment decisions. Always consult with qualified financial professionals before making investment choices.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages