Live demo: https://credit-risk-intel-auro.streamlit.app
Repo: https://github.com/Aurokrishnaa/credit-risk-intelligence-Auro
Stress, assess, and price credit portfolios with explainable PD/LGD/EAD analytics, CECL/IFRS lifetime loss, covenant headroom, and a print-ready executive report, built in Python/Streamlit by Aurokrishnaa R L (MS Finance—Quant · MBA Finance).
- Highlights
- What’s inside (end-to-end flow)
- Screenshots
- Quickstart
- Usage guide
- Data schema
- Modeling details
- Risk tiers & stress design
- Covenants & watchlist
- CECL / IFRS
- Risk-based pricing
- Report Mode (print/PDF)
- Performance & limits
- Project structure
- Troubleshooting
- Roadmap
- License
- Author & contact
- Robust data ingestion: CSV template (download in-app), tolerant encoding/sep loader (UTF-8/UTF-8-SIG/Latin-1; comma/semicolon) and clean rate parsing.
- Core risk stack: PD / LGD / EAD / EL at loan level with transparent heuristics and safeguards.
- Macro stress testing: rate (bps), unemployment (pp), and collateral shocks flow through cashflow metrics → PD/LGD/EAD/EL.
- Covenants & watchlist: DSCR, ICR, LTV, DTI headroom with Green/Amber/Red badges and a downloadable exceptions file.
- CECL/IFRS lifetime EL: amortization curve + monthly default hazard + PV discount.
- Risk-based pricing: EL% + (capital + opex + profit) → suggested spread (bps) and all-in rate.
- Executive reporting: polished Report Mode with snapshot locking, PII masking, charts, and print/PDF styles.
- Tech: Streamlit · pandas · NumPy · numpy-financial · Matplotlib.
- App version:
v1.3.0.
Data → Base risk → Stress → CECL → Covenants → Pricing → Report
- Ingest & validate: upload CSV or click Use sample dataset.
- Derive cashflows & ratios: payment, balance @ 12m, interest Y1, LTV/DTI/DSCR/ICR.
- Estimate base risk: PD (scorecard), LGD (collateral haircuts), EAD (12m avg), EL.
- Apply stress: rate/unemp/collateral shocks propagate; PD/LGD/EAD/EL recomputed.
- Tier & concentrate: PD-percentile tiers (Low/Med/High); top sectors/geos by EAD.
- Covenants: compute headroom, badge (R/A/G), watchlist & export.
- CECL/IFRS: lifetime EL (PV) using monthly default intensity over amortization.
- Pricing: translate risk into suggested spread (bps) and all-in rate.
- Report Mode: one-click print/PDF with KPI deltas, composition, watchlist, and pricing insights.
# clone
git clone https://github.com/Aurokrishnaa/credit-risk-intelligence-Auro.git
cd credit-risk-intelligence-Auro
# (optional) create a venv
python3.12 -m venv .venv
# mac/linux
source .venv/bin/activate
# windows (powershell)
# .venv\Scripts\Activate.ps1
# install
python -m pip install -U pip
pip install -r requirements.txt
# run
streamlit run app.pyRequirements
- Python 3.12
streamlit,pandas,numpy,numpy-financial,matplotlib(pinned inrequirements.txt)
-
Get started
- Click Download CSV template, replace sample rows, keep the same headers.
- Or click Use sample dataset to explore features instantly.
- Upload your CSV (≤ 200 MB).
-
Scenario & filters
- Sidebar: choose Base / Adverse / Severe / Custom (rate bps, unemployment pp, collateral drop %).
- Global filters: Sector, Geography, and Risk tier (stressed).
-
Explore tabs
- Overview: KPIs (EAD / w-avg PD / EL / High-risk%) and key charts.
- Data: first rows + derived metrics; validation issues (if any).
- Base Risk: loan-level PD/LGD/EAD/EL and PD-tiering.
- Stress Test: shocked PD/LGD/EAD/EL and tier mix.
- Covenants & Watchlist: DSCR/ICR/LTV/DTI headroom, badges, exceptions CSV.
- CECL / IFRS: lifetime EL (PV) with discount rate.
- Pricing: suggested spread (bps) & all-in rate; export pricing table (CSV).
- Reports: Report Mode → Print / Save as PDF (browser dialog).
-
Notes
- InterestRate is numeric. For 7.5%, use
0.075or7.5(no%sign). - Minimal required columns:
LoanAmount,InterestRate,TermMonths.
- InterestRate is numeric. For 7.5%, use
Minimal required
LoanAmount(USD)InterestRate(decimal or percent numeric; e.g.,0.075or7.5for 7.5%)TermMonths(>0)
Recommended (for richer analytics)
LoanID,Borrower,Sector,GeographyCreditScore(300–850)MonthlyIncome,NOI,EBITDACollateralType,CollateralValue,CurrentMarketValueExistingDTI
The app auto-selects CurrentMarketValue (if valid) else CollateralValue as CollateralBase.
Validation checks
- Positive
LoanAmount/TermMonths, valid numericInterestRate CreditScorein [300, 850] (if provided)- Collateral presence/positivity
- Rows with issues appear in Data → Rows with data issues
-
Monthly payment
A = pmt(r/12, n, -P)with zero-rate guard. -
Outstanding balance @ 12m: amortization formula with edge-case handling.
-
First-year interest: month-by-month loop.
-
Ratios:
LTV = LoanAmount / CollateralBaseDTI = MonthlyPayment / MonthlyIncomeDSCR = NOI / AnnualDebtService(orMonthlyIncome×12 / AnnualDebtServiceas fallback)ICR = EBITDA / Interest_Y1
-
Base by CreditScore bands (prime → subprime), then multiplicative factors:
- DTI buckets (↑ leverage → ↑ PD)
- LTV buckets (↑ leverage → ↑ PD)
- Sector factor (e.g., hospitality/retail > manufacturing/healthcare)
-
Clamped to
[0.2%, 35%].
- Haircuts by
CollateralType(e.g., real estate 30%, equipment 45%, inventory/AR 60%, securities 10%). - Recovery cost (10%) then
LGD = 1 − min(effective collateral / LoanAmount, 1)×(1 − recovery_cost); clamp[5%, 95%].
EAD_12m = 0.5 × (LoanAmount + Balance@12m).
EL_12m = PD_12m × LGD × EAD_12m.
- Percentile-based on base PD (≈33/66 cuts) with a stable fallback when samples are small.
- Stressed tiers reuse base PD cutpoints for comparability.
- Rate shock (bps) → raises payment/DSCR/DTI → feeds PD & balances.
- Unemployment shock (pp) → multiplicative PD uplift
min(1 + 0.10×pp, 2.5). - Collateral drop (%) → lower
CollateralBase→ higher LTV → feeds LGD/PD. - All recalculated metrics (PD/LGD/EAD/EL) are shown under Stress Test.
-
Headroom under stress:
HR_DSCR = DSCR_st − DSCR_minHR_ICR = ICR_st − ICR_minHR_LTV = LTV_max − LTV_stHR_DTI = DTI_max − DTI_st
-
Badges: Red (breach), Amber (near), Green (healthy) using user thresholds + amber buffers.
-
Watchlist: Red/Amber sorted by WorstHeadroom; Download Exceptions (CSV).
-
Monthly default probability from 12-month PD:
p_m = 1 − (1 − PD_12m)^(1/12). -
Lifetime EL (PV) loops over months:
- survival ×
p_mgives default mass each month EAD_tis outstanding balanceEL_t = survival × p_m × LGD × EAD_t- discount by
(1 + r/12)^t(user-set discount rate)
- survival ×
-
Reported as totals and as
% of start EADfor Base and Stressed.
- EL rate (stressed):
EL_12m_st / EAD_12m_st. - Suggested spread:
EL% + (capital buffer + opex + target profit). - All-in rate:
funding cost + spread. - Portfolio-level metrics + downloadable pricing table (CSV).
- Snapshot lock to freeze metrics and charts for printing.
- Mask sensitive IDs (LoanID/Borrower) toggle for sharing.
- Detailed View explains methods and stack inline.
- Browser print dialog → Print / Save as PDF (letter/A4, default/narrow margins, hide headers/footers).
- Upload limit: 200 MB (CSV).
- Caching: heavy calcs wrapped with
@st.cache_data(payments, balances, lifetime EL). - Matplotlib runs on the
Aggbackend for reliable image generation.
credit-risk-intelligence-Auro/
├─ .streamlit/ # Streamlit config/theme
├─ data/ # Template/sample CSVs (written by the app)
├─ app.py # Main Streamlit application
├─ requirements.txt # Python dependencies
├─ LICENSE # MIT
└─ Assets/ # Screenshots of the app
The app may create
reports/at runtime for convenience; it is not required to be committed.
- “Unsupported or unreadable CSV” → export as UTF-8, comma-delimited; start from the in-app template.
- “Required columns missing” → ensure headers match exactly. Minimal:
LoanAmount,InterestRate,TermMonths. - Interest rate parsing → use
0.075or7.5for 7.5% (no%). - Empty view after filters → set Sector/Geography/Tier back to All (the app auto-relaxes the tightest filter and warns).
- Odds/Logit PD option with simple calibration helper
- Multi-period EAD (amortizing/utilization profiles)
- Scenario manager (save & compare)
- CSV schema lint with column type hints
This project is licensed under the MIT License. See LICENSE.
Aurokrishnaa R L — MS Finance (Quant) · MBA Finance
- Website: https://www.aurokrishnaa.me
- LinkedIn: https://www.linkedin.com/in/aurokrishnaa
Models are demo-calibrated for illustration only and are not a production credit policy or financial advice.









