QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
SABR volatility (smile) surface. More...
#include <sabrvolsurface.hpp>
Public Member Functions | |
SabrVolSurface (const ext::shared_ptr< InterestRateIndex > &, Handle< BlackAtmVolCurve >, const std::vector< Period > &optionTenors, std::vector< Spread > atmRateSpreads, std::vector< std::vector< Handle< Quote > > > volSpreads) | |
TermStructure interface | |
DayCounter | dayCounter () const override |
the day counter used for date/time conversion More... | |
Date | maxDate () const override |
the latest date for which the curve can return values More... | |
Time | maxTime () const override |
the latest time for which the curve can return values More... | |
const Date & | referenceDate () const override |
the date at which discount = 1.0 and/or variance = 0.0 More... | |
Calendar | calendar () const override |
the calendar used for reference and/or option date calculation More... | |
Natural | settlementDays () const override |
the settlementDays used for reference date calculation More... | |
VolatilityTermStructure interface | |
Real | minStrike () const override |
the minimum strike for which the term structure can return vols More... | |
Real | maxStrike () const override |
the maximum strike for which the term structure can return vols More... | |
const Handle< BlackAtmVolCurve > & | atmCurve () const |
BlackVolSurface interface | |
ext::shared_ptr< SmileSection > | smileSectionImpl (Time) const override |
Public Member Functions inherited from InterestRateVolSurface | |
InterestRateVolSurface (ext::shared_ptr< InterestRateIndex >, BusinessDayConvention bdc=Following, const DayCounter &dc=DayCounter()) | |
InterestRateVolSurface (ext::shared_ptr< InterestRateIndex >, const Date &referenceDate, const Calendar &cal=Calendar(), BusinessDayConvention bdc=Following, const DayCounter &dc=DayCounter()) | |
initialize with a fixed reference date More... | |
InterestRateVolSurface (ext::shared_ptr< InterestRateIndex >, Natural settlementDays, const Calendar &, BusinessDayConvention bdc=Following, const DayCounter &dc=DayCounter()) | |
calculate the reference date based on the global evaluation date More... | |
Date | optionDateFromTenor (const Period &) const |
period/date conversion More... | |
const ext::shared_ptr< InterestRateIndex > & | index () const |
Public Member Functions inherited from BlackVolSurface | |
BlackVolSurface (BusinessDayConvention bdc=Following, const DayCounter &dc=DayCounter()) | |
default constructor More... | |
BlackVolSurface (const Date &referenceDate, const Calendar &cal=Calendar(), BusinessDayConvention bdc=Following, const DayCounter &dc=DayCounter()) | |
initialize with a fixed reference date More... | |
BlackVolSurface (Natural settlementDays, const Calendar &, BusinessDayConvention bdc=Following, const DayCounter &dc=DayCounter()) | |
calculate the reference date based on the global evaluation date More... | |
ext::shared_ptr< SmileSection > | smileSection (const Period &, bool extrapolate) const |
returns the smile for a given option tenor More... | |
ext::shared_ptr< SmileSection > | smileSection (const Date &, bool extrapolate) const |
returns the smile for a given option date More... | |
ext::shared_ptr< SmileSection > | smileSection (Time, bool extrapolate) const |
returns the smile for a given option time More... | |
Public Member Functions inherited from BlackAtmVolCurve | |
BlackAtmVolCurve (BusinessDayConvention bdc=Following, const DayCounter &dc=DayCounter()) | |
default constructor More... | |
BlackAtmVolCurve (const Date &referenceDate, const Calendar &cal=Calendar(), BusinessDayConvention bdc=Following, const DayCounter &dc=DayCounter()) | |
initialize with a fixed reference date More... | |
BlackAtmVolCurve (Natural settlementDays, const Calendar &, BusinessDayConvention bdc=Following, const DayCounter &dc=DayCounter()) | |
calculate the reference date based on the global evaluation date More... | |
~BlackAtmVolCurve () override=default | |
Volatility | atmVol (const Period &optionTenor, bool extrapolate=false) const |
spot at-the-money volatility More... | |
Volatility | atmVol (const Date &maturity, bool extrapolate=false) const |
spot at-the-money volatility More... | |
Volatility | atmVol (Time maturity, bool extrapolate=false) const |
spot at-the-money volatility More... | |
Real | atmVariance (const Period &optionTenor, bool extrapolate=false) const |
spot at-the-money variance More... | |
Real | atmVariance (const Date &maturity, bool extrapolate=false) const |
spot at-the-money variance More... | |
Real | atmVariance (Time maturity, bool extrapolate=false) const |
spot at-the-money variance More... | |
Public Member Functions inherited from VolatilityTermStructure | |
VolatilityTermStructure (BusinessDayConvention bdc, const DayCounter &dc=DayCounter()) | |
VolatilityTermStructure (const Date &referenceDate, const Calendar &cal, BusinessDayConvention bdc, const DayCounter &dc=DayCounter()) | |
initialize with a fixed reference date More... | |
VolatilityTermStructure (Natural settlementDays, const Calendar &cal, BusinessDayConvention bdc, const DayCounter &dc=DayCounter()) | |
calculate the reference date based on the global evaluation date More... | |
virtual BusinessDayConvention | businessDayConvention () const |
the business day convention used in tenor to date conversion More... | |
Date | optionDateFromTenor (const Period &) const |
period/date conversion More... | |
Public Member Functions inherited from TermStructure | |
TermStructure (DayCounter dc=DayCounter()) | |
default constructor More... | |
TermStructure (const Date &referenceDate, Calendar calendar=Calendar(), DayCounter dc=DayCounter()) | |
initialize with a fixed reference date More... | |
TermStructure (Natural settlementDays, Calendar, DayCounter dc=DayCounter()) | |
calculate the reference date based on the global evaluation date More... | |
~TermStructure () override=default | |
Time | timeFromReference (const Date &date) const |
date/time conversion More... | |
void | update () override |
Public Member Functions inherited from Observer | |
Observer ()=default | |
Observer (const Observer &) | |
Observer & | operator= (const Observer &) |
virtual | ~Observer () |
std::pair< iterator, bool > | registerWith (const ext::shared_ptr< Observable > &) |
void | registerWithObservables (const ext::shared_ptr< Observer > &) |
Size | unregisterWith (const ext::shared_ptr< Observable > &) |
void | unregisterWithAll () |
virtual void | update ()=0 |
virtual void | deepUpdate () |
Public Member Functions inherited from Observable | |
Observable () | |
Observable (const Observable &) | |
Observable & | operator= (const Observable &) |
Observable (Observable &&)=delete | |
Observable & | operator= (Observable &&)=delete |
virtual | ~Observable ()=default |
void | notifyObservers () |
Public Member Functions inherited from Extrapolator | |
Extrapolator ()=default | |
virtual | ~Extrapolator ()=default |
void | enableExtrapolation (bool b=true) |
enable extrapolation in subsequent calls More... | |
void | disableExtrapolation (bool b=true) |
disable extrapolation in subsequent calls More... | |
bool | allowsExtrapolation () const |
tells whether extrapolation is enabled More... | |
LazyObject interface | |
Handle< BlackAtmVolCurve > | atmCurve_ |
std::vector< Period > | optionTenors_ |
std::vector< Time > | optionTimes_ |
std::vector< Date > | optionDates_ |
std::vector< Spread > | atmRateSpreads_ |
std::vector< std::vector< Handle< Quote > > > | volSpreads_ |
bool | isAlphaFixed_ |
bool | isBetaFixed_ |
bool | isNuFixed_ |
bool | isRhoFixed_ |
bool | vegaWeighted_ |
std::vector< std::array< Real, 4 > > | sabrGuesses_ |
void | performCalculations () const |
void | update () override |
void | registerWithMarketData () |
void | checkInputs () const |
void | updateSabrGuesses (const Date &d, std::array< Real, 4 > newGuesses) const |
Visitability | |
void | accept (AcyclicVisitor &) override |
std::vector< Volatility > | volatilitySpreads (const Period &) const |
std::vector< Volatility > | volatilitySpreads (const Date &) const |
std::array< Real, 4 > | sabrGuesses (const Date &) const |
Additional Inherited Members | |
Public Types inherited from Observer | |
typedef set_type::iterator | iterator |
Protected Member Functions inherited from BlackVolSurface | |
Real | atmVarianceImpl (Time t) const override |
spot at-the-money variance calculation More... | |
Volatility | atmVolImpl (Time t) const override |
spot at-the-money volatility calculation More... | |
Calculations | |
These methods must be implemented in derived classes to perform the actual volatility calculations. When they are called, range check has already been performed; therefore, they must assume that extrapolation is required. | |
Protected Member Functions inherited from VolatilityTermStructure | |
void | checkStrike (Rate strike, bool extrapolate) const |
strike-range check More... | |
Protected Member Functions inherited from TermStructure | |
void | checkRange (const Date &d, bool extrapolate) const |
date-range check More... | |
void | checkRange (Time t, bool extrapolate) const |
time-range check More... | |
Protected Attributes inherited from InterestRateVolSurface | |
ext::shared_ptr< InterestRateIndex > | index_ |
Protected Attributes inherited from TermStructure | |
bool | moving_ = false |
bool | updated_ = true |
Calendar | calendar_ |
SabrVolSurface | ( | const ext::shared_ptr< InterestRateIndex > & | index, |
Handle< BlackAtmVolCurve > | atmCurve, | ||
const std::vector< Period > & | optionTenors, | ||
std::vector< Spread > | atmRateSpreads, | ||
std::vector< std::vector< Handle< Quote > > > | volSpreads | ||
) |
|
overridevirtual |
the day counter used for date/time conversion
Reimplemented from TermStructure.
Definition at line 106 of file sabrvolsurface.hpp.
|
overridevirtual |
the latest date for which the curve can return values
Implements TermStructure.
Definition at line 110 of file sabrvolsurface.hpp.
|
overridevirtual |
the latest time for which the curve can return values
Reimplemented from TermStructure.
Definition at line 114 of file sabrvolsurface.hpp.
|
overridevirtual |
the date at which discount = 1.0 and/or variance = 0.0
Reimplemented from TermStructure.
Definition at line 118 of file sabrvolsurface.hpp.
|
overridevirtual |
the calendar used for reference and/or option date calculation
Reimplemented from TermStructure.
Definition at line 122 of file sabrvolsurface.hpp.
|
overridevirtual |
the settlementDays used for reference date calculation
Reimplemented from TermStructure.
Definition at line 126 of file sabrvolsurface.hpp.
|
overridevirtual |
the minimum strike for which the term structure can return vols
Implements VolatilityTermStructure.
Definition at line 130 of file sabrvolsurface.hpp.
|
overridevirtual |
the maximum strike for which the term structure can return vols
Implements VolatilityTermStructure.
Definition at line 134 of file sabrvolsurface.hpp.
const Handle< BlackAtmVolCurve > & atmCurve | ( | ) | const |
Definition at line 138 of file sabrvolsurface.hpp.
|
overridevirtual |
Reimplemented from InterestRateVolSurface.
Definition at line 172 of file sabrvolsurface.cpp.
std::vector< Volatility > volatilitySpreads | ( | const Period & | p | ) | const |
Definition at line 143 of file sabrvolsurface.hpp.
std::vector< Volatility > volatilitySpreads | ( | const Date & | d | ) | const |
|
overridevirtual |
Implements BlackVolSurface.
Definition at line 118 of file sabrvolsurface.cpp.
|
protected |
|
overrideprotectedvirtual |
This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.
Implements Observer.
Definition at line 107 of file sabrvolsurface.cpp.
|
private |
Definition at line 147 of file sabrvolsurface.cpp.
|
private |
Definition at line 156 of file sabrvolsurface.cpp.
Definition at line 76 of file sabrvolsurface.cpp.
|
private |
Definition at line 88 of file sabrvolsurface.hpp.
|
private |
Definition at line 89 of file sabrvolsurface.hpp.
|
private |
Definition at line 90 of file sabrvolsurface.hpp.
|
private |
Definition at line 91 of file sabrvolsurface.hpp.
|
private |
Definition at line 92 of file sabrvolsurface.hpp.
Definition at line 93 of file sabrvolsurface.hpp.
|
private |
Definition at line 95 of file sabrvolsurface.hpp.
|
private |
Definition at line 96 of file sabrvolsurface.hpp.
|
private |
Definition at line 97 of file sabrvolsurface.hpp.
|
private |
Definition at line 98 of file sabrvolsurface.hpp.
|
private |
Definition at line 99 of file sabrvolsurface.hpp.
|
mutableprivate |
Definition at line 101 of file sabrvolsurface.hpp.