Skip to content

Fix the parameter key of setCreditMigrationAnalytic (#361) - #362

Open
dazivo wants to merge 1 commit into
OpenSourceRisk:masterfrom
dazivo:fix/credit-migration-setter-key
Open

dazivo wants to merge 1 commit into
OpenSourceRisk:masterfrom
dazivo:fix/credit-migration-setter-key

Conversation

@dazivo

@dazivo dazivo commented Sep 10, 2026

Copy link
Copy Markdown

Fixes #361.

InputParameters::setCreditMigrationAnalytic(bool) wrote its argument to the kvaTheirCvaRiskWeight key instead of creditMigration, so the flag never reached XvaAnalytic, and the bool left under the risk-weight key made loadParameter<Real> fall through to loadParameterString(), whose any_cast<string> then threw out of the XVA parameter loading. The setter now writes to creditMigration.

The added InputParametersTest calls the setter and checks that ("xva", "creditMigration") loads as true and that loading ("xva", "kvaTheirCvaRiskWeight") neither throws nor changes the value. Before the fix the first check fails and the second throws bad_any_cast; after the fix both pass (built and run on macOS arm64, release preset).

The setter is reachable from Python through orea_app.i; the call in Examples/ORE-API/oreApi.py is inside a commented-out block, so no shipped example changes.

The setter wrote its flag to kvaTheirCvaRiskWeight instead of
creditMigration, so credit migration was never enabled from the API and
the bool left under the risk weight key made the XVA parameter loading
throw a bad_any_cast. Add an InputParameters test for the setter.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q5n2ExoAFe9qtbybzMxnsQ
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.

InputParameters::setCreditMigrationAnalytic writes to the kvaTheirCvaRiskWeight key

1 participant