-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fx options utils - BlackVolatilitySurfaceDelta class
#2368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fx options utils - BlackVolatilitySurfaceDelta class
#2368
Conversation
… iterpolateSmileSection
lballabio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! A few comments, some of them for @pcaspers.
|
|
||
| namespace QuantLib { | ||
|
|
||
| namespace { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An anonymous namespace in a header file doesn't make a lot of sense—namespace detail is better.
|
|
||
|
|
||
| //! Extrapolate black variance using flat vol extrapolation in time direction | ||
| Real timeExtrapolatationBlackVarianceFlat(const Time t, const std::vector<double>& times, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"extrapolatation" (here and everywhere)
| Copyright (C) 2019 Quaternion Risk Management Ltd | ||
| Copyright (C) 2022 Skandinaviska Enskilda Banken AB (publ) | ||
| Copyright (C) 2025 Paolo D'Elia | ||
| All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"All rights reserved" is in contradiction with the terms of the license below. If it's in the ORE code (it looks like it), we need to ask for its removal. @pcaspers, any idea why it's there?
| DeltaVolQuote::DeltaType dt = DeltaVolQuote::DeltaType::Spot, | ||
| DeltaVolQuote::AtmType at = DeltaVolQuote::AtmType::AtmDeltaNeutral, | ||
| ext::optional<DeltaVolQuote::DeltaType> atmDeltaType = ext::nullopt, | ||
| const Period& switchTenor = 0 * Days, | ||
| DeltaVolQuote::DeltaType ltdt = DeltaVolQuote::DeltaType::Fwd, | ||
| DeltaVolQuote::AtmType ltat = DeltaVolQuote::AtmType::AtmDeltaNeutral, | ||
| ext::optional<DeltaVolQuote::DeltaType> longTermAtmDeltaType = ext::nullopt, | ||
| SmileInterpolationMethod interpolationMethod = | ||
| SmileInterpolationMethod::Linear, | ||
| bool flatStrikeExtrapolation = false, | ||
| BlackVolTimeExtrapolation timeExtrapolation = | ||
| BlackVolTimeExtrapolation::FlatVolatility); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of default parameters here—@pcaspers, is their order based on your usage patterns? (i.e., are the last ones also the least likely to be passed?)
|
|
||
| if (flatStrikeExtrapolation_) { | ||
| if (strike < minStrike()) { | ||
| v = minStrike(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either this should be v = interpolation_(minStrike(), true) or the whole check should be moved before the call to interpolation_(strike, true); and used to change strike instead.
|
|
||
| if (flatStrikeExtrapolation_) { | ||
| if (strike < minStrike()) { | ||
| return minStrike(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. You want to return the vol corresponding to the min strike, not the min strike itself. I have a feeling we're probably missing a couple of tests for this part?
| template <class Interpolator> | ||
| void InterpolatedSmileSection<Interpolator>::checkStrikes() { | ||
| if (!std::is_sorted(strikes_.begin(), strikes_.end())) { | ||
| std::vector<Size> indices(strikes_.size(), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't try to fix the input. I'd just raise an exception and let the user sort it out (pun not intended).
Added
BlackVolatilitySurfaceDeltaclass from ORE, a Black volatility surface parameterized by market deltas, mainly used in Building FX/equity volatility surfaces from market delta quotes.QL changes @lballabio:
BlackVolatilitySurfaceDeltaclassInterpolatedSmileSectionclass as an additional constructor parameter, required from theBlackVolatilitySurfaceDeltaclass and from ORE's implementation ofInterpolatedSmileSectionclassInterepolatedSmileSectionclass (logic implemented incheckStrikes()private method), thought you guys might need it since it was underlined in the commentsORE Changes @pcaspers:
InterpolatedSmileSectionclass to retrive the SmileSection from theblackVolSmilemethod in theBlackVolatilitySurfaceDeltaclass instead of the QLEInterpolatedSmileSectionsince they provide the same functionalities, (QL'sInterpolatedSmileSectionis actually more complete than the QLE ones, but the latter is derived formFxSmileSectionnot present in QL) thus there no need to introduce another redundant class.