Skip to content

UK Credit Risk + Counterparty Credit Risk RWA Calculator

Welcome to the documentation for the UK Credit Risk + Counterparty Credit Risk RWA Calculator - a high-performance system for calculating Risk-Weighted Assets (RWA) for UK credit risk and counterparty credit risk exposures. Derivative and SFT exposures are measured via the Standardised Approach for Counterparty Credit Risk (SA-CCR) under CRR Art. 271-311, producing an EAD that feeds the same SA / IRB exposure ladder as on-balance-sheet credit risk.

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, and computes Counterparty Credit Risk EAD for derivative and SFT portfolios via SA-CCR.

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
  • Counterparty Credit Risk (SA-CCR): Derivative EAD via CRR Art. 271-311 using EAD = α · (RC + PFE) with α = 1.4 per Art. 274(2); RC (Art. 275), PFE add-on (Art. 278) including the FX asset class, hedging-set aggregation, supervisory deltas, and the Art. 272(4) legal-enforceability netting gate are all in scope. See the SA-CCR specifications.
  • Credit Risk Mitigation: Complete CRM support including collateral, guarantees, and provisions
  • Audit Trail: Error accumulation and full traceability for regulatory compliance
  • Parallel-Run Reconciliation: Compare outputs against your existing/legacy calculator, component by component, to gain comfort the numbers are right before you migrate. See the Reconciliation guide.
  • Extensible Architecture: Protocol-based design enabling easy customization

Who Is This Documentation For?

This documentation serves multiple audiences:

For Engineers

For Risk & Audit Teams

For Business Users

Quick Navigation

  • Getting Started


    Install the calculator and run your first RWA calculation

    Quick Start

  • Migrate with Confidence


    Reconcile this calculator against your existing one before you switch

    Reconciliation

  • Regulatory Frameworks


    Understand CRR and Basel 3.1 regulatory requirements

    Regulations

  • Calculation Methods


    Learn how SA, IRB, and CRM calculations work

    Methodology

  • API Reference


    Complete technical documentation for developers

    API Docs

  • Counterparty Credit Risk


    SA-CCR EAD for derivatives and SFTs (CRR Art. 271-311)

    SA-CCR Specs

Calculation Pipeline Overview

The RWA calculator processes exposures through a six-stage pipeline: Load → Hierarchy → Classify → CRM → Calculate → Aggregate.

Details: See Pipeline Architecture for the full stage-by-stage walkthrough with diagrams.

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
SA-CCR Counterparty credit risk EAD for derivatives and SFTs: EAD = α · (RC + PFE) with α = 1.4 (Art. 271-311) 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 (5,034 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.3.4
CRR Support Full
Basel 3.1 Support Complete
Python Required >= 3.13