Skip to content

Commit dadd3a2

Browse files
authored
Revise README for clarity on project scope and objectives
Updated project description and objectives for clarity and focus on model risk validation.
1 parent 3eaf9e1 commit dadd3a2

1 file changed

Lines changed: 167 additions & 35 deletions

File tree

README.md

Lines changed: 167 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,196 @@
11
# Integrated Risk App (Python)
22

3-
An interactive **Streamlit web app** that brings together **market risk** and **credit risk** analytics in one tool — built from scratch in Python.
4-
It demonstrates the ability to design, code, and validate professional risk models, including VaR/ES, backtesting, stress testing, and credit Expected Loss.
3+
Model Risk Validation Sandbox for Market & Credit Risk (Python)
54

6-
## 📸 Screenshots
5+
This project is a model-risk–oriented risk analytics engine designed to measure, validate, and document market and credit risk models in a manner consistent with institutional risk management and model validation practices.
76

8-
**1. Market Risk Backtest (VaR & Exceptions)**
9-
![Backtest Screenshot](docs/screenshot_1.png)
10-
*Shows daily portfolio returns vs. the 99% VaR threshold. Red dots = exceedances. Used to validate if the model’s predicted risk matches actual losses (Kupiec POF test).*
7+
The focus is not on building a dashboard, but on demonstrating rigorous risk modeling, backtesting, and governance-aware design, with clear assumptions, diagnostics, and limitations.
118

12-
**2. Credit Risk — Expected Loss (Batch)**
13-
![Credit Screenshot](docs/screenshot_2.png)
14-
*Aggregates Probability of Default (PD), Loss Given Default (LGD), and Exposure at Default (EAD) across facilities. Displays total expected losses and a breakdown by segment, useful for monitoring credit portfolios.*
9+
## 🎯 Project Objective (North Star)
10+
11+
Build a validation-ready risk engine that computes core risk measures (VaR, ES, Expected Loss) and evaluates their reliability using standard model risk diagnostics.
12+
13+
This repository is structured to resemble how pensions, model risk teams, and risk consultancies organize and review quantitative risk models.
14+
15+
## 📌 Scope (What This Project Intentionally Covers)
16+
Market Risk
17+
18+
Value-at-Risk (VaR) and Expected Shortfall (ES)
19+
20+
Methods:
21+
22+
Historical Simulation
23+
24+
Parametric (Normal)
25+
26+
Monte Carlo
27+
28+
Filtered Historical (GARCH-lite)
29+
30+
Rolling window estimation
31+
32+
Backtesting using Kupiec Proportion-of-Failures (POF) test
33+
34+
Multi-confidence-level calibration (e.g. 95%, 99%)
35+
36+
Credit Risk
37+
38+
Expected Loss (EL) framework:
39+
40+
Probability of Default (PD)
41+
42+
Loss Given Default (LGD)
43+
44+
Exposure at Default (EAD)
1545

16-
Interactive Streamlit app for market & credit risk:
17-
- VaR/ES: Historical, Parametric (Normal), Monte Carlo, GARCH-lite (Filtered Historical)
18-
- Backtesting: rolling VaR with Kupiec POF test + multi-alpha calibration
19-
- Analytics: correlation heatmap, VaR decomposition, what-if weights
20-
- Stress & Scenarios: equity shocks, rates (duration), correlation bumps, historical window replay
21-
- Credit: Expected Loss (batch)
22-
- Risk Budgeting: Equal Risk Contribution (ERC)
46+
Batch portfolio-level aggregation
47+
48+
Segment-level loss breakdown for monitoring
49+
50+
Stress & Scenario Analysis
51+
52+
Deterministic equity shocks
53+
54+
Interest-rate shocks using duration approximations
55+
56+
Correlation stress
57+
58+
Historical window replay
59+
60+
## 🚫 Out of Scope (By Design)
61+
62+
To preserve clarity and rigor, this project does not attempt to be:
63+
64+
A trading or portfolio optimization system
65+
66+
A real-time production risk engine
67+
68+
A regulatory-approved model
69+
70+
Advanced extensions (e.g. factor models, ALM, optimization) are intentionally deferred.
71+
72+
🖥 Application Interface
73+
74+
A lightweight Streamlit interface is provided only as a viewer to:
75+
76+
Run models with selected parameters
77+
78+
Visualize backtests and stress results
79+
80+
Inspect outputs interactively
81+
82+
All core modeling logic resides outside the UI to ensure separation between model logic and presentation.
2383

2484
**Live Demo:** <https://integrated-risk-app.onrender.com/>
2585

26-
## ⚡ Quickstart
86+
📸 Example Outputs
2787

28-
Clone the repo, install dependencies, and launch the app:
88+
Market Risk Backtesting (VaR & Exceptions)
89+
Daily portfolio returns plotted against the VaR threshold.
90+
Red points represent exceedances used in Kupiec backtesting.
91+
92+
Credit Risk – Expected Loss (Batch)
93+
Aggregated EL with breakdown by segment, illustrating portfolio-level credit exposure.
94+
![Credit Screenshot](docs/screenshot_2.png)
95+
96+
97+
## 🧠 Methodology Overview
98+
99+
VaR: loss threshold exceeded with probability
100+
1
101+
102+
𝛼
103+
1−α
104+
105+
Expected Shortfall: average loss conditional on VaR exceedance
106+
107+
Kupiec POF Test: statistical test for unconditional coverage
108+
109+
Filtered Historical Simulation: volatility-adjusted return filtering
110+
111+
Expected Loss:
112+
PD
113+
×
114+
LGD
115+
×
116+
EAD
117+
PD×LGD×EAD
118+
119+
All models follow a loss-based convention (risk measures reported as positive loss values).
120+
121+
## 🧪 Validation & Testing Philosophy
122+
123+
This project emphasizes model validation, not just model output.
124+
125+
Unit tests verify:
126+
127+
Monotonicity of VaR across confidence levels
128+
129+
ES ≥ VaR under consistent loss conventions
130+
131+
Correct behavior of backtesting logic
132+
133+
Credit EL aggregation consistency
134+
135+
Backtesting results are interpretable and reproducible
136+
137+
Assumptions and limitations are explicitly acknowledged
138+
139+
## ⚙️ Tech Stack
140+
141+
Python — core modeling language
142+
143+
Streamlit — lightweight interface
144+
145+
Pandas / NumPy — data handling and numerical computation
146+
147+
SciPy / Statsmodels — statistical modeling
148+
149+
Plotly — interactive visualization
150+
151+
yfinance — market data (demo use only)
152+
153+
## ⚡ Quickstart
29154

30155
```bash
31156
git clone https://github.com/sensor-aae/Integrated-Risk-App.git
32157
cd Integrated-Risk-App
33-
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
158+
159+
python -m venv .venv
160+
source .venv/bin/activate # Windows: .venv\Scripts\activate
161+
34162
pip install -r requirements.txt
35163
streamlit run app/app.py
36164
```
37-
## 🛠 Tech Stack
38165

39-
- **Python** — core language for all risk modeling
40-
- **Streamlit** — interactive web app framework
41-
- **Pandas & NumPy** — data handling, returns, matrix math
42-
- **Plotly** — dynamic charts (backtests, stress tests, EL by segment)
43-
- **yfinance** — market data source for demo
44-
- **SciPy / Statsmodels** — statistics & GARCH-lite modeling
166+
Demo datasets are included so the app can be explored immediately.
45167

46-
Demo CSVs are included in data/ so you can click around immediately.
168+
## 📄 Documentation
47169

48-
## 📊 How it works
170+
A Model Risk Report (methodology, assumptions, validation results, and limitations) is maintained in the /docs directory and is intended to mirror institutional model documentation standards.
49171

50-
VaR = loss threshold at confidence level α.
172+
## ⚠️ Disclaimer
51173

52-
ES = average loss beyond VaR.
174+
This project is for educational and demonstrative purposes only.
175+
It is not intended for production use or investment decision-making.
53176

54-
Kupiec test = checks if exceedances match expectation.
177+
## ⭐ Why This Project Exists
55178

56-
FHS (GARCH-lite) = filters volatility for better tail calibration.
179+
This repository is designed as a work sample for roles in:
57180

58-
ERC weights = equalize each asset’s risk contribution.
181+
Risk Analytics
59182

60-
## ⚠️ Disclaimer
61-
For educational use only. Not investment advice.
183+
Model Risk / Model Validation
184+
185+
Credit Risk
186+
187+
Pension & Institutional Investment Risk
188+
189+
Risk Consulting
190+
191+
It reflects how quantitative risk models are built, tested, challenged, and documented — not just how they are computed.
192+
An interactive **Streamlit web app** that brings together **market risk** and **credit risk** analytics in one tool — built from scratch in Python.
193+
It demonstrates the ability to design, code, and validate professional risk models, including VaR/ES, backtesting, stress testing, and credit Expected Loss.
62194

63195

64196

0 commit comments

Comments
 (0)