UK Credit Risk RWA Calculator¶
Welcome to the documentation for the UK Credit Risk RWA Calculator - a high-performance system for calculating Risk-Weighted Assets (RWA) for UK credit risk exposures.
Development Status
This package is still in development and is not yet production ready. APIs may change between versions.
Documentation: https://OpenAfterHours.github.io/rwa_calculator/
Source Code: https://github.com/OpenAfterHours/rwa_calculator
Overview¶
This calculator supports both current and forthcoming UK regulatory frameworks:
| Framework | Status | Effective Date |
|---|---|---|
| CRR (Basel 3.0) | Active | Until 31 December 2026 |
| Basel 3.1 (PRA PS1/26) | Planned | From 1 January 2027 |
The system provides accurate, auditable RWA calculations across all major exposure classes using both the Standardised Approach (SA) and Internal Ratings-Based (IRB) approaches.
Key Features¶
- Dual-Framework Support: Single codebase supporting both CRR and Basel 3.1 regulations
- High Performance: Built on Polars LazyFrames for vectorized operations, achieving 50-100x performance improvements
- Full Regulatory Coverage: Implements all exposure classes including Central Govt / Central Bank, Institution, Corporate, Retail, and Specialised Lending
- Credit Risk Mitigation: Complete CRM support including collateral, guarantees, and provisions
- Audit Trail: Error accumulation and full traceability for regulatory compliance
- Extensible Architecture: Protocol-based design enabling easy customization
Who Is This Documentation For?¶
This documentation serves multiple audiences:
For Engineers¶
- Architecture Guide - Understand the system design and components
- API Reference - Complete API documentation for all modules
- Development Guide - Testing, extending, and contributing
For Risk & Audit Teams¶
- Regulatory Frameworks - Detailed coverage of CRR and Basel 3.1 requirements
- Calculation Methodology - How RWAs are calculated
- Exposure Classes - Classification and treatment of exposures
For Business Users¶
- Getting Started - Quick introduction and setup
- User Guide - Comprehensive usage documentation
- Glossary - Terminology and definitions
Quick Navigation¶
-
Getting Started
Install the calculator and run your first RWA calculation
-
Regulatory Frameworks
Understand CRR and Basel 3.1 regulatory requirements
-
Calculation Methods
Learn how SA, IRB, and CRM calculations work
-
API Reference
Complete technical documentation for developers
Calculation Pipeline Overview¶
The RWA calculator processes exposures through a well-defined pipeline:
graph LR
A[Raw Data] --> B[Loader]
B --> C[Hierarchy Resolver]
C --> D[Classifier]
D --> E[CRM Processor]
E --> F{Approach}
F -->|SA| G[SA Calculator]
F -->|IRB| H[IRB Calculator]
F -->|Slotting| I[Slotting Calculator]
F -->|Equity| L[Equity Calculator]
G --> J[Aggregator]
H --> J
I --> J
L --> J
J --> K[Final RWA]
Supported Calculations¶
By Approach¶
| Approach | Description | Framework Support |
|---|---|---|
| Standardised (SA) | Risk weights based on external ratings and exposure characteristics | CRR, Basel 3.1 |
| Foundation IRB (F-IRB) | Bank-estimated PD, supervisory LGD | CRR, Basel 3.1 |
| Advanced IRB (A-IRB) | Bank-estimated PD, LGD, and EAD | CRR, Basel 3.1 |
| Slotting | Category-based approach for specialised lending | CRR, Basel 3.1 |
| Equity | Risk weights for equity holdings (Art. 133 SA / Art. 155 IRB Simple) | CRR, Basel 3.1 |
By Exposure Class¶
| Class | SA | F-IRB | A-IRB | Slotting |
|---|---|---|---|---|
| Central Govt / Central Bank | ||||
| Institution | ||||
| Corporate | ||||
| Corporate SME | ||||
| Retail Mortgage | ||||
| Retail QRRE | ||||
| Retail Other | ||||
| Specialised Lending | ||||
| Equity |
Technology Stack¶
The calculator is built using modern, high-performance technologies:
- Python 3.13+ - Latest Python features
- Polars - Vectorized DataFrame operations with LazyFrame optimization
- polars-normal-stats - Pure Polars statistical functions for IRB formulas
- Pytest - Comprehensive test coverage (2,065+ tests)
Regulatory References¶
This implementation follows:
- PRA Rulebook - CRR Firms rules
- UK CRR - EU 575/2013 as onshored
- PRA PS1/26 - Basel 3.1 implementation policy statement
- BCBS CRE Standards - Basel Committee credit risk standards
See the Regulatory References appendix for complete documentation links.
Version Information¶
| Component | Version |
|---|---|
| Calculator | 0.1.50 |
| CRR Support | Full |
| Basel 3.1 Support | Complete |
| Python Required | >= 3.13 |