Volatility Forecasting & Value-at-Risk Modeling Using ML & Econometrics
FinRisk Analytics is an institutional-grade risk modeling platform that combines classical econometric methods (GARCH, EGARCH) with modern machine learning (LSTM, XGBoost) to forecast volatility and calculate Value-at-Risk across multiple asset classes.
Key Features:
- π Multi-model volatility forecasting (GARCH, EGARCH, LSTM)
β οΈ Value-at-Risk calculation (5 methods)- π Expected Shortfall (CVaR) analysis
- π Statistical backtesting (Kupiec test)
- π Correlation regime detection
- π± Interactive Streamlit dashboard
- π Crisis period stress testing
finrisk-analytics/
βββ configs/ # Configuration files
βββ data/ # Data storage
β βββ raw/ # Raw market data
β βββ processed/ # Cleaned data
β βββ features/ # Engineered features
βββ notebooks/ # Jupyter notebooks (5 total)
βββ src/ # Source code
β βββ data/ # Data handling
β βββ models/ # GARCH & LSTM models
β βββ risk/ # VaR calculation & backtesting
β βββ correlation/ # Correlation analysis
β βββ utils/ # Utilities
βββ dashboard/ # Streamlit dashboard
βββ results/ # Outputs
β βββ plots/ # Visualizations
β βββ reports/ # Risk reports
β βββ models/ # Trained models
βββ tests/ # Unit tests
git clone https://github.com/aniktahabilder/finrisk-analytics.git
cd finrisk-analytics# Create virtual environment
python3 -m venv venv
# Activate (Linux/Mac)
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtEdit configs/config.yaml to customize:
- Date ranges
- Asset universe
- Model parameters
- VaR confidence levels
Option A: Jupyter Notebooks
jupyter notebook
# Run notebooks in order:
# 01_volatility_eda.ipynb
# 02_garch_models.ipynb
# 03_lstm_volatility.ipynb
# 04_var_calculation.ipynb
# 05_portfolio_risk.ipynbOption B: Interactive Dashboard
streamlit run dashboard/app.py15 Assets across 4 Classes:
| Category | Assets | Purpose |
|---|---|---|
| Equities | SPY, XLK, XLF, XLV, XLE, XLI | Market + sector risk |
| Fixed Income | TLT, IEF | Duration risk |
| Alternatives | GLD, BTC, ETH, SOL | Diversification risk |
| Macro | VIX | Volatility indicator |
Deep-dive case studies: SPY, BTC, ETH, TLT
Classical Econometrics:
- GARCH(1,1) - Baseline volatility clustering
- EGARCH - Asymmetric volatility (leverage effect)
- GJR-GARCH - Captures negative shock impact
Machine Learning:
- LSTM - Sequential time-series patterns
- LSTM-GARCH Hybrid - Combined approach
- XGBoost - Feature-based volatility
- Historical Simulation - Empirical distribution
- Parametric (Normal) - Gaussian assumption
- Parametric (Student-t) - Fat tails
- Cornish-Fisher - Skewness/kurtosis adjusted
- Filtered Historical Simulation - GARCH + historical
- Value-at-Risk (95%, 99% confidence)
- Expected Shortfall (CVaR)
- Rolling correlations
- Regime-dependent correlations
- Portfolio VaR (multi-asset)
- VaR violation counting
- Kupiec test (statistical validation)
- Traffic light approach (Basel framework)
- Crisis period analysis (March 2020, 2022)
| Metric | Target |
|---|---|
| Volatility Forecast RMSE | < 2% |
| VaR Coverage (95%) | 4-6% violations |
| Kupiec Test | Pass at 5% |
| Expected Shortfall Error | < 10% |
| Dashboard Load Time | < 3 seconds |
Interactive Streamlit App:
- Real-time volatility charts
- VaR breach timeline visualization
- Correlation heatmaps (by regime)
- Portfolio risk calculator
- Model comparison view
- Crisis scenario analysis
Launch:
streamlit run dashboard/app.pyThis is part of a three-project portfolio:
- Market Intelligence ML - Price prediction
- FinRisk Analytics β You are here
- AlphaRL Portfolio - RL optimization
Integration: This project provides volatility forecasts and VaR estimates that feed into Project 3's RL agent for risk-aware portfolio optimization.
Core:
- pandas, numpy, scipy
- scikit-learn, xgboost, tensorflow
Econometrics:
- arch (GARCH models)
- statsmodels
Visualization:
- matplotlib, seaborn, plotly
- streamlit (dashboard)
Financial Data:
- yfinance, ccxt
See requirements.txt for complete list.
Risk Management:
- Portfolio risk monitoring
- VaR calculation for regulatory compliance
- Stress testing under crisis scenarios
- Early warning system for volatility spikes
Quantitative Research:
- Volatility model comparison
- Risk factor attribution
- Correlation regime analysis
Portfolio Management:
- Risk budgeting
- Dynamic hedging strategies
- Capital allocation decisions
# Run unit tests
pytest tests/
# Run with coverage
pytest --cov=src tests/- Implement data fetching pipeline
- Fit GARCH models on all assets
- Train LSTM volatility models
- Calculate VaR using all methods
- Run Kupiec backtesting
- Analyze correlation regimes
- Build interactive dashboard
- Generate risk reports
- Crisis period analysis
- Write technical documentation
This is a personal portfolio project. Feedback and suggestions are welcome!
MIT License - see LICENSE file.
Anik Tahabilder
- PhD Student, Computer Science, Wayne State University
- Research: Multimodal AI, Blockchain Security, Quantitative Finance
- GitHub: @aniktahabilder
- GARCH methodology from Engle (2001) and Bollerslev (1986)
- VaR backtesting framework based on Basel Committee guidelines
- Built as part of comprehensive ML/Finance portfolio
For questions or collaboration:
- GitHub: aniktahabilder
- Email: [your-email]
β If you find this project useful, please consider giving it a star!