Skip to content

Add equity investments in funds (CRE60) — v0.22.0#27

Merged
ankitjha67 merged 1 commit into
mainfrom
claude/equity-in-funds
Jun 29, 2026
Merged

Add equity investments in funds (CRE60) — v0.22.0#27
ankitjha67 merged 1 commit into
mainfrom
claude/equity-in-funds

Conversation

@ankitjha67

Copy link
Copy Markdown
Owner

Summary

New rwa/equity_in_funds.py implementing the BCBS CRE60 hierarchy for risk-weighting a bank's equity investments in funds.

What's new

  • fund_average_risk_weight(underlying_rwa, fund_total_assets) and fund_leverage(total_assets, total_equity) — the two LTA/MBA inputs
  • look_through_rwa(...) / mandate_based_rwa(...)RWA = min(avg_RW × leverage, 1250%) × investment
  • fall_back_rwa(investment) — the 1250% Fall-Back Approach

Each returns a FundRWAResult (approach, effective risk weight, RWA, cap-binding flag); the avg-RW × leverage product is capped at 1250% per CRE60.7.

Tests

13 new tests covering the average-RW and leverage helpers, the LTA/MBA calculation, the 1250% cap binding, the fall-back, and validation. Module at 100% coverage.

Full suite: 2,761 passing, 100% line coverage (8,337 statements), mypy clean (171 files), ruff clean. Version 0.22.0.

🤖 Generated with Claude Code


Generated by Claude Code

New rwa/equity_in_funds.py implementing the CRE60 hierarchy.

- fund_average_risk_weight / fund_leverage: the fund's average risk weight
  (underlying RWA / total assets) and leverage (assets / equity).
- look_through_rwa / mandate_based_rwa: RWA = min(avg_RW * leverage,
  1250%) * investment for the Look-Through and Mandate-Based approaches.
- fall_back_rwa: the 1250% Fall-Back Approach.

Each returns a FundRWAResult with the effective risk weight, RWA, and a
cap-binding flag.

13 new tests; module at 100% coverage. Full suite 2,761 passing, 100%
line coverage, mypy and ruff clean. Bumps to 0.22.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PktGA7a3zzvbAczr6UhrsT
Signed-off-by: Claude <noreply@anthropic.com>
@ankitjha67 ankitjha67 merged commit 7f3819e into main Jun 29, 2026
1 of 5 checks passed
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ankitjha67, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 24 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1706f92e-4dcf-494b-870c-dd8b77498a14

📥 Commits

Reviewing files that changed from the base of the PR and between a533cfe and 0d7abdd.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • README.md
  • docs/architecture.md
  • pyproject.toml
  • src/creditriskengine/__init__.py
  • src/creditriskengine/rwa/equity_in_funds.py
  • tests/test_rwa/test_equity_in_funds.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/equity-in-funds

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d7abdd273

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

investment=round(investment, 6),
effective_risk_weight=_MAX_RISK_WEIGHT,
rwa=round(_MAX_RISK_WEIGHT * investment, 6),
capped=True,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark fall-back results as uncapped

When fall_back_rwa() is used because neither LTA nor MBA applies, the 1250% weight is the approach itself, not the CRE60 cap on an avg_RW × leverage calculation. Setting capped=True makes every fall-back exposure look like a cap-binding LTA/MBA result, which conflicts with the FundRWAResult.capped contract and can mislead audit/reporting consumers that distinguish fallback from capped look-through results.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants