Skip to content

Bhagy-Yelleti/SmartRisk_Pro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartRisk Pro

Enterprise Credit Risk & Capital Management Platform

Investment banking-grade risk management system with Basel III compliance, credit modeling, and stress testing.


✨ Features

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)

🛠️ Tech Stack

Backend: FastAPI, SQLAlchemy, SQLite
ML: scikit-learn, NumPy, pandas, SciPy
Frontend: JavaScript, Chart.js
Architecture: Domain-Driven Design


📦 Installation

# 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.py

Open: http://localhost:8000


🚀 Quick Start

  1. Load Portfolio Data (200 sample loans)
  2. Build Credit Model (train PD model)
  3. Assess Portfolio Risk (calculate EL, UL, EC)
  4. Run Stress Test (apply scenarios)
  5. Calculate Capital (Basel III requirements)

API Docs: http://localhost:8000/docs


📁 Project Structure

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

📐 Key Formulas

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

⚙️ Configuration

Create .env:

DATABASE_URL=sqlite:///./smartrisk.db
MODEL_REGISTRY_PATH=./model_registry
API_PORT=8000

🧪 Testing

pip install pytest pytest-cov
pytest --cov=.

Built for Risk Professionals

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors