Finance & Risk

Stock Portfolio Analysis Pipeline

Automated ETL + Monte Carlo simulation mapping the efficient frontier across 5,000 portfolio allocations.

View on GitHub

Results

Key Metrics

5,000

Monte Carlo Simulations

2 yrs

Equity Data Ingested

8

Financial Stocks Tracked

MPT

Optimization Framework

Approach

Technical Overview

ETL Pipeline Design

Historical price data for 8 financial stocks was pulled from Yahoo Finance and ingested into a normalized SQLite database through an automated pipeline. The schema tracks prices, returns, and computed statistics separately to support analytical queries without recomputation.

Modern Portfolio Theory Implementation

Portfolio optimization was implemented from first principles using MPT — computing expected returns, the covariance matrix of asset returns, and portfolio variance analytically. This forms the mathematical foundation for the efficient frontier calculation.

Monte Carlo Simulation

5,000 random portfolio weight allocations were simulated and plotted in risk-return space to map the efficient frontier empirically. Each simulation computes annualized return, volatility, and Sharpe ratio, allowing visual identification of the optimal risk-adjusted allocation.

Sharpe Ratio Optimization

The Sharpe-optimal portfolio — the point on the efficient frontier with the highest risk-adjusted return — was identified from the simulation results. This is the standard metric used by portfolio managers to compare strategies on a risk-normalized basis.

Gallery

Output & Visualizations

Demo screenshots and output visualizations — coming soon.

Efficient Frontier
Correlation Heatmap
Normalized Price History
Returns Distribution (AAPL)

Efficient Frontier5,000 simulated portfolios with Sharpe-optimal highlighted

Correlation HeatmapAsset return correlations across the 8-stock universe

Normalized Price HistoryAll 8 stocks normalized to base 100 over 2 years

Returns Distribution (AAPL)Daily return histogram with normal distribution overlay

Stack

Technologies Used

Language
Python
Data
pandasNumPy
Storage
SQLite
Visualization
matplotlibseaborn
Data Source
Yahoo Finance API