Skip to content

Allow G2SwaptionEngine to price cash-settled (CollateralizedCashPrice) swaptions - #2996

Open
leafyoung wants to merge 1 commit into
lballabio:masterfrom
leafyoung:fix-g2swaptionengine-settlement-method
Open

leafyoung wants to merge 1 commit into
lballabio:masterfrom
leafyoung:fix-g2swaptionengine-settlement-method

Conversation

@leafyoung

Copy link
Copy Markdown

Summary

G2SwaptionEngine::calculate() rejects every Settlement::Cash swaption outright, including CollateralizedCashPrice, even though its valuation never reads settlementType/settlementMethod again after the guard and has the same payoff for Physical and Cash+CollateralizedCashPrice settlement — the two differ only in whether the underlying swap is physically entered into or cash-settled after exercise, not in price.

Every other engine performing the same style of valuation (replicating the exercise payoff from the underlying swap's own cashflows under a short-rate model) already guards with the strictly broader settlementMethod != Settlement::ParYieldCurve:

  • JamshidianSwaptionEngine
  • Gaussian1dJamshidianSwaptionEngine
  • Gaussian1dSwaptionEngine
  • Gaussian1dNonstandardSwaptionEngine
  • Gaussian1dFloatFloatSwaptionEngine
  • TreeSwaptionEngine

which admits CollateralizedCashPrice and rejects only ParYieldCurve (the one convention whose payoff genuinely differs — it needs an annuity-based formula none of these engines implement). G2SwaptionEngine appears to have been missed when the other six were updated to this convention; this brings it in line with the rest of the module.

Test plan

  • Added testG2SwaptionEngineCashSettlement in test-suite/bermudanswaption.cpp: prices the same European swaption under Settlement::Physical and Settlement::Cash+CollateralizedCashPrice with G2SwaptionEngine and checks the NPVs match, and confirms Cash+ParYieldCurve is still correctly rejected.
  • Verified the new test fails with the old guard (cash-settled swaptions not priced with G2 engine) and passes with the fix.
  • Ran the full BermudanSwaptionTests suite (testCachedValues, testCachedG2Values, testTreeEngineTimeSnapping, testBermudanOISSwaptionWithHW, testBermudanOISSwaptionWithG2, testBermudanOISSwaptionPreservesFeatures) — all pass.

🤖 Co-worked with Claude Code

…) swaptions

G2SwaptionEngine::calculate() rejected every Settlement::Cash swaption
outright, including CollateralizedCashPrice, even though the engine's
valuation (adjusting the fixed rate for the floating-leg spread, then
calling G2::swaption() on the underlying swap's own cashflows) never reads
settlementType or settlementMethod again after the guard and has the same
payoff for Physical and Cash+CollateralizedCashPrice settlement -- they
differ only in whether the underlying swap is physically entered into or
cash-settled after exercise, not in the swaption's price.

Every sibling engine performing the same style of valuation already
guards with the strictly broader `settlementMethod != ParYieldCurve`
(JamshidianSwaptionEngine, Gaussian1dJamshidianSwaptionEngine,
Gaussian1dSwaptionEngine, Gaussian1dNonstandardSwaptionEngine,
Gaussian1dFloatFloatSwaptionEngine, TreeSwaptionEngine), which admits
CollateralizedCashPrice and rejects only ParYieldCurve -- the one
settlement convention whose payoff genuinely differs (it uses an
annuity-based formula these engines don't implement). G2SwaptionEngine
was apparently missed when the other six engines were updated to this
convention. This brings it in line with the rest of the module.

Adds a regression test (testG2SwaptionEngineCashSettlement) checking that
a Cash+CollateralizedCashPrice swaption prices identically to the same
swaption settled Physically, and that Cash+ParYieldCurve is still
correctly rejected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@leafyoung
leafyoung marked this pull request as ready for review November 1, 2026 03:47
Copilot AI balanced review requested due to automatic review settings November 1, 2026 03:47

Copilot AI 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.

🟢 Approval recommended

No active review issues are reported for the G2SwaptionEngine cash-settlement update.

No open issues 🎉

What changed in this PR

Updates G2SwaptionEngine to support cash-settled swaptions using CollateralizedCashPrice, aligning its settlement guard with other short-rate swaption engines.

Changes:

  • Allows CollateralizedCashPrice settlement while continuing to reject ParYieldCurve.
  • Adds a regression test checking physical/cash-settled NPV equality and rejection of the unsupported convention.
File Description
test-suite/​bermudanswaption.cpp Adds settlement acceptance, price-equivalence, and rejection checks.
ql/​pricingengines/​swaption/​g2swaptionengine.hpp Replaces the physical-only guard with a ParYieldCurve exclusion.

Review effort: Balanced

@leafyoung

Copy link
Copy Markdown
Author

Thanks for the review — noted, nothing further needed here.

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