Skip to content

Add optional forward parameter to SmileSection pricing methods#2489

Open
quantales wants to merge 1 commit intolballabio:masterfrom
quantales:feature/smilesection-optional-forward
Open

Add optional forward parameter to SmileSection pricing methods#2489
quantales wants to merge 1 commit intolballabio:masterfrom
quantales:feature/smilesection-optional-forward

Conversation

@quantales
Copy link
Contributor

This PR proposes adding an optional forward parameter (defaulting to Null<Real>()) to SmileSection::optionPrice(), digitalOptionPrice(), vega(), and density().

Currently these methods rely on atmLevel() to obtain the forward, and fail at runtime if it returns Null<Real>().

This works for IR smile sections which always know their forward, but equity/FX smile sections often don't. A SmileSection obtained from a BlackVolTermStructure (see #2487) or constructed from market data without a forward hits this QL_REQUIRE as soon as optionPrice() or density() is called.

The optional forward parameter lets callers provide the forward at the call site when the smile doesn't know it.

When forward is not passed (or passed as Null<Real>()), behavior is unchanged, atmLevel() is used as before. Fully backwards compatible.

All derived classes that override these methods (NoArbSabrSmileSection, ZabrSmileSection, Gaussian1dSmileSection, KahaleSmileSection, AtmAdjustedSmileSection) have been updated to match the new signatures. They ignore the forward parameter since they already know their forward via atmLevel().

Note: for digitalOptionPrice and density, the forward parameter comes after gap to preserve backwards compatibility.

Tests: forward-aware calls on a forward-unaware FlatSmileSection produce correct prices (verified against blackFormula), and are consistent with atmLevel-based results on forward-aware smiles. Full suite passes.

@pcaspers, @lballabio, would appreciate your feedback on this, especially regarding the parameter ordering for digitalOptionPrice and density where forward comes after gap.

@quantales quantales force-pushed the feature/smilesection-optional-forward branch from 30293a3 to 5878112 Compare March 15, 2026 19:03
@coveralls
Copy link

coveralls commented Mar 15, 2026

Coverage Status

coverage: 74.366%. remained the same
when pulling fd39138 on quantales:feature/smilesection-optional-forward
into 68f4edf on lballabio:master.

@quantales quantales force-pushed the feature/smilesection-optional-forward branch from c9f0b44 to fd39138 Compare March 16, 2026 12:15
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