Implementation of a Historical Simulation Value at Risk (VaR) framework in Python, including Expected Shortfall, portfolio P&L estimation, backtesting analysis, and Basel Traffic Light classification.
This project implements an end-to-end Historical Simulation Value at Risk (VaR) framework using Python.
The model estimates portfolio risk using empirical return distributions and evaluates model performance through backtesting and Basel Traffic Light classification.
- Historical Simulation VaR (99%)
- Expected Shortfall (ES)
- Portfolio-level P&L computation
- VaR backtesting and breach analysis
- Basel Traffic Light regulatory classification
- Risk visualisation (time-series and distribution-based)
- Load historical market price data
- Compute log returns
- Construct a portfolio using predefined weights
- Generate daily P&L
- Estimate VaR and ES using rolling historical windows
- Perform backtesting to identify VaR breaches
- Classify model performance using the Basel Traffic Light framework
- data/ - market price data
- src/ - risk engine modules
- notebooks/ - execution and analysis
- requirements.txt - dependencies
- Install dependencies: pip install -r requirements.txt
- Open the notebook notebooks/run_model.ipynb
- Run cells sequentially to:
- compute VaR & ES
- perform backtesting
- visualize breaches
- generate Basel classification