Skip to content

thigmen/sp500-financial-report

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S&P 500 Financial Analysis Report

An interactive financial analysis web report built with Python and Dash, covering the top 10 most liquid stocks in the S&P 500 index over a 5-year period. Built as part of a BI Developer portfolio to demonstrate quantitative analysis and data visualization skills.

🔗 Live Demo

Free tier — may take ~50s to wake up on first load.

preview

Python Dash Plotly Pandas Scikit-learn


Features

The report is divided into 10 interactive sections:

# Section What it shows
01 Price History Normalized closing prices across all tickers
02 Returns Distribution Daily return histograms with normal distribution fit
03 Correlation Matrix Pearson correlation heatmap between assets
04 Rolling Volatility 30-day annualized rolling standard deviation
05 Risk / Return Annualized return vs. volatility scatter plot
06 Risk Metrics Sharpe Ratio, Max Drawdown, VaR 95%, CVaR 95%
07 Technical Analysis Interactive Bollinger Bands with RSI
08 Efficient Frontier Monte Carlo simulation with optimal portfolios
09 Clustering KMeans clustering of stocks by risk/return profile
10 Conclusions Key takeaways from the full analysis

Tech Stack

  • Dash / Plotly — interactive web charts and layout
  • Pandas / NumPy — data pipeline and feature engineering
  • Scikit-learn — KMeans clustering
  • SciPy — normal distribution fitting
  • Gunicorn — production WSGI server

Dataset

S&P 500 Stock Data — Kaggle
https://www.kaggle.com/datasets/camnugent/sandp500

Historical daily OHLCV data for S&P 500 companies from 2013 to 2018.
The report automatically selects the top 10 stocks by average daily trading volume.

The dataset CSV is not included in this repository. Download it from Kaggle and place all_stocks_5yr.csv in the project root before running.


Running Locally

# 1. Clone the repository
git clone https://github.com/thigmen/sp500-financial-report.git
cd sp500-financial-report

# 2. Install dependencies
pip install -r requirements.txt

# 3. Download the dataset from Kaggle and place it in the project root
#    File: all_stocks_5yr.csv

# 4. Run the app
python report.py

Then open http://127.0.0.1:8050 in your browser.


Key Concepts Demonstrated

  • Financial metrics: Sharpe Ratio, Max Drawdown, Value at Risk (VaR), Conditional VaR (CVaR)
  • Portfolio optimization: Monte Carlo Efficient Frontier (10,000 simulations)
  • Technical analysis: Bollinger Bands, RSI (Relative Strength Index)
  • Machine learning: KMeans clustering for asset grouping
  • Statistics: Normal distribution fitting, rolling correlation/volatility
  • Data visualization: 11 interactive Plotly charts with dark theme

Project Structure

sp500-financial-report/
├── report.py          # Main Dash application
├── analysis.py        # Standalone analysis script
├── assets/
│   └── report.css     # Custom CSS (smooth scroll, sticky nav, print)
├── requirements.txt
└── Procfile           # Gunicorn entry point for deployment

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages