This project implements Value-at-Risk (VaR) using two standard approaches:
- Historical Simulation (non-parametric)
- Parametric Variance–Covariance (assuming normal returns)
The objective is to estimate potential portfolio losses at 95% and 99% confidence levels, and to compare how assumptions about return distributions affect risk estimates.
main.ipynb— Jupyter notebook with full implementationplots/— saved figures (histograms, VaR cutoffs, comparisons)requirements.txt— dependenciesREADME.md— project documentation
- Data: Daily adjusted close prices from Yahoo Finance (
yfinance) for selected tickers (AAPL, MSFT, GOOGL, AMZN, META, JPM, XOM, SPY). - Returns: Daily log returns.
- Historical Simulation VaR: Empirical quantiles of the return distribution.
- Parametric VaR: Normal distribution assumption, formula:
[ \text{VaR}\alpha = - \big( \mu + z\alpha \sigma \big) ] - Portfolio: Equal-weight portfolio of all tickers.
Sample window: 2020-01-01 → Current
Portfolio: Equal-weight, daily log returns
Historical Simulation VaR
- Asset AAPL: VaR_95 = 3.17 %, VaR_99 = 5.22 %
- Portfolio: VaR_95 = 2.3 %, VaR_99 = 4.47 %
Parametric VaR
- Asset AAPL: VaR_95 = 3.25 % , VaR_99 = 4.63 %
- Portfolio: VaR_95 = 2.49 % , VaR_99 = 3.55 %
Comparison (portfolio).
- Historical VaR is typically more conservative, capturing empirical fat tails.
- Parametric VaR assumes normality, which can underestimate tail risk.
- Diversification reduced risk at the portfolio level vs single assets.
Figures:
hist_var_portfolio.png— histogram of portfolio returns with VaR cutoffsvar_comparison_portfolio.png— overlay of historical vs parametric VaR
This project highlighted the importance of distributional assumptions in risk modeling. Historical VaR captured heavier tails compared to normal-based estimates, underscoring how parametric methods can underestimate risk.
Diversification effects were visible in the portfolio VaR, though tail sensitivity remains.
Next steps:
- Extend to multi-day horizons (10-day VaR via square-root-of-time rule)
- Implement Conditional VaR (Expected Shortfall)
- Evaluate robustness with rolling windows and alternative weighting schemes
Install dependencies with:
pip install -r requirements.txt