Financial Calculations & Valuation Advanced

Calculate RAROC (Risk-Adjusted Return on Capital) for Corporate Loan Pricing in Python

Price corporate loans accurately in Python by computing Risk-Adjusted Return on Capital (RAROC) using Cost of Funds, Expected Loss (PD x LGD), and Economic Capital.

#numpy

Problem Statement

Charging a flat interest rate across borrowers of different credit ratings destroys bank shareholder value. RAROC measures whether the net spread earned on a loan after Cost of Funds, Operating Cost, and Expected Credit Loss exceeds the bank's hurdle ROE.

Formula / Core Logic

Risk_Adjusted_Revenue = Interest_Income + Fee_Income - Cost_of_Funds - Operating_Costs - Expected_Loss RAROC = (Risk_Adjusted_Revenue * (1 - Tax_Rate)) / Economic_Capital_At_Risk

Installation

pip install numpy
raroc-risk-adjusted-return-on-capital-loan-pricing-python.py
def calculate_loan_raroc(exposure, loan_rate_pct, cost_of_funds_pct, op_cost_pct, pd_pct, lgd_pct, economic_cap_pct=10.0, tax_rate=0.25):
    rev = exposure * (loan_rate_pct / 100.0)
    cof = exposure * (cost_of_funds_pct / 100.0)
    opex = exposure * (op_cost_pct / 100.0)
    expected_loss = exposure * (pd_pct / 100.0) * (lgd_pct / 100.0)
    
    economic_capital = exposure * (economic_cap_pct / 100.0)
    net_pre_tax = rev - cof - opex - expected_loss
    net_post_tax = net_pre_tax * (1.0 - tax_rate)
    raroc_pct = (net_post_tax / economic_capital) * 100.0
    return {
        'Net_Spread_Income': round(rev - cof, 2),
        'Expected_Loss_Provision': round(expected_loss, 2),
        'Economic_Capital_Allocated': round(economic_capital, 2),
        'Post_Tax_RAROC_Pct': round(raroc_pct, 2),
        'Clears_15Pct_Hurdle': raroc_pct >= 15.0
    }

Get the Complete 100+ Python Quant & Automation Bundle

Instant lifetime access to all production-ready scripts, valuation models, and trading bots ($19).

Buy Full Bundle on Gumroad ($19) →

Frequently Asked Questions

Q: How is RAROC used during loan sanction negotiations?

If a borrower negotiates a lower interest rate that pushes RAROC below the bank's 15% ROE hurdle, the relationship manager must ask for collateral or upfront processing fees to compensate.