Enterprise Credit Risk & Capital Management Platform
Investment banking-grade risk management system with Basel III compliance, credit modeling, and stress testing.
Credit Risk Modeling
- ML-based PD model (Logistic Regression + Calibration)
- Model versioning with performance tracking
- S&P rating scale mapping (AAA to D)
Risk Analytics
- Expected Loss (EL): PD × LGD × EAD
- Unexpected Loss (UL): Portfolio volatility with correlation
- Economic Capital (EC): VaR(99.9%) - EL
- Concentration metrics: HHI, diversification score
Basel III Compliance
- IRB Foundation & Standardized approaches
- Capital buffers (Conservation, Countercyclical, G-SIB)
- Risk-weighted assets (RWA) computation
Stress Testing
- Severe Recession, Moderate Stress, Stagflation scenarios
- Macro parameter shocks (unemployment, GDP, rates, housing)
Backend: FastAPI, SQLAlchemy, SQLite
ML: scikit-learn, NumPy, pandas, SciPy
Frontend: JavaScript, Chart.js
Architecture: Domain-Driven Design
# Clone and setup
git clone <repository-url>
cd smartrisk-pro
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
# Run
python main.pyOpen: http://localhost:8000
- Load Portfolio Data (200 sample loans)
- Build Credit Model (train PD model)
- Assess Portfolio Risk (calculate EL, UL, EC)
- Run Stress Test (apply scenarios)
- Calculate Capital (Basel III requirements)
API Docs: http://localhost:8000/docs
smartrisk-pro/
├── domain/ # Business logic
│ ├── entities.py # Loan, RiskScore, CapitalPosition
│ ├── value_objects.py # PD, LGD, EAD, UL
│ └── services/ # Basel III, Stress, Analytics
├── application/ # Use cases & workflows
├── infrastructure/ # Data access layer
├── models/ # ML models & registry
├── routes/ # API endpoints
├── frontend/ # Dashboard UI
├── database.py # ORM models
└── main.py # Entry point
Expected Loss
EL = PD × LGD × EAD
Unexpected Loss
UL = EAD × LGD × √(PD × (1 - PD))
Economic Capital
EC = VaR(99.9%) - EL
Basel III RWA
RWA = K × 12.5 × EAD
K = [LGD × N((N⁻¹(PD) + √ρ × N⁻¹(0.999)) / √(1-ρ)) - PD × LGD] × MA
Create .env:
DATABASE_URL=sqlite:///./smartrisk.db
MODEL_REGISTRY_PATH=./model_registry
API_PORT=8000pip install pytest pytest-cov
pytest --cov=.Built for Risk Professionals