Repository navigation
Conversation
…) 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>
There was a problem hiding this comment.
🟢 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
CollateralizedCashPricesettlement while continuing to rejectParYieldCurve. - 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
Author
|
Thanks for the review — noted, nothing further needed here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
G2SwaptionEngine::calculate()rejects everySettlement::Cashswaption outright, includingCollateralizedCashPrice, even though its valuation never readssettlementType/settlementMethodagain after the guard and has the same payoff forPhysicalandCash+CollateralizedCashPricesettlement — 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:JamshidianSwaptionEngineGaussian1dJamshidianSwaptionEngineGaussian1dSwaptionEngineGaussian1dNonstandardSwaptionEngineGaussian1dFloatFloatSwaptionEngineTreeSwaptionEnginewhich admits
CollateralizedCashPriceand rejects onlyParYieldCurve(the one convention whose payoff genuinely differs — it needs an annuity-based formula none of these engines implement).G2SwaptionEngineappears 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
testG2SwaptionEngineCashSettlementintest-suite/bermudanswaption.cpp: prices the same European swaption underSettlement::PhysicalandSettlement::Cash+CollateralizedCashPricewithG2SwaptionEngineand checks the NPVs match, and confirmsCash+ParYieldCurveis still correctly rejected.cash-settled swaptions not priced with G2 engine) and passes with the fix.BermudanSwaptionTestssuite (testCachedValues,testCachedG2Values,testTreeEngineTimeSnapping,testBermudanOISSwaptionWithHW,testBermudanOISSwaptionWithG2,testBermudanOISSwaptionPreservesFeatures) — all pass.🤖 Co-worked with Claude Code