QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SabrVolSurface Class Reference

SABR volatility (smile) surface. More...

#include <ql/experimental/volatility/sabrvolsurface.hpp>

+ Inheritance diagram for SabrVolSurface:
+ Collaboration diagram for SabrVolSurface:

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 DatereferenceDate () 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< SmileSectionsmileSectionImpl (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< SmileSectionsmileSection (const Period &, bool extrapolate) const
 returns the smile for a given option tenor More...
 
ext::shared_ptr< SmileSectionsmileSection (const Date &, bool extrapolate) const
 returns the smile for a given option date More...
 
ext::shared_ptr< SmileSectionsmileSection (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 &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (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 &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (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< BlackAtmVolCurveatmCurve_
 
std::vector< PeriodoptionTenors_
 
std::vector< TimeoptionTimes_
 
std::vector< DateoptionDates_
 
std::vector< SpreadatmRateSpreads_
 
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< VolatilityvolatilitySpreads (const Period &) const
 
std::vector< VolatilityvolatilitySpreads (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< InterestRateIndexindex_
 
- Protected Attributes inherited from TermStructure
bool moving_ = false
 
bool updated_ = true
 
Calendar calendar_
 

Detailed Description

SABR volatility (smile) surface.

blah blah

Definition at line 39 of file sabrvolsurface.hpp.

Constructor & Destructor Documentation

◆ SabrVolSurface()

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 
)

Definition at line 30 of file sabrvolsurface.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ dayCounter()

DayCounter dayCounter ( ) const
overridevirtual

the day counter used for date/time conversion

Reimplemented from TermStructure.

Definition at line 106 of file sabrvolsurface.hpp.

◆ maxDate()

Date maxDate ( ) const
overridevirtual

the latest date for which the curve can return values

Implements TermStructure.

Definition at line 110 of file sabrvolsurface.hpp.

◆ maxTime()

Time maxTime ( ) const
overridevirtual

the latest time for which the curve can return values

Reimplemented from TermStructure.

Definition at line 114 of file sabrvolsurface.hpp.

◆ referenceDate()

const Date & referenceDate ( ) const
overridevirtual

the date at which discount = 1.0 and/or variance = 0.0

Reimplemented from TermStructure.

Definition at line 118 of file sabrvolsurface.hpp.

+ Here is the caller graph for this function:

◆ calendar()

Calendar calendar ( ) const
overridevirtual

the calendar used for reference and/or option date calculation

Reimplemented from TermStructure.

Definition at line 122 of file sabrvolsurface.hpp.

◆ settlementDays()

Natural settlementDays ( ) const
overridevirtual

the settlementDays used for reference date calculation

Reimplemented from TermStructure.

Definition at line 126 of file sabrvolsurface.hpp.

◆ minStrike()

Real minStrike ( ) const
overridevirtual

the minimum strike for which the term structure can return vols

Implements VolatilityTermStructure.

Definition at line 130 of file sabrvolsurface.hpp.

◆ maxStrike()

Real maxStrike ( ) const
overridevirtual

the maximum strike for which the term structure can return vols

Implements VolatilityTermStructure.

Definition at line 134 of file sabrvolsurface.hpp.

◆ atmCurve()

const Handle< BlackAtmVolCurve > & atmCurve ( ) const

Definition at line 138 of file sabrvolsurface.hpp.

◆ accept()

void accept ( AcyclicVisitor v)
overridevirtual

Reimplemented from InterestRateVolSurface.

Definition at line 172 of file sabrvolsurface.cpp.

+ Here is the call graph for this function:

◆ volatilitySpreads() [1/2]

std::vector< Volatility > volatilitySpreads ( const Period p) const

Definition at line 143 of file sabrvolsurface.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ volatilitySpreads() [2/2]

std::vector< Volatility > volatilitySpreads ( const Date d) const

Definition at line 88 of file sabrvolsurface.cpp.

+ Here is the call graph for this function:

◆ sabrGuesses()

std::array< Real, 4 > sabrGuesses ( const Date d) const
protected

Definition at line 66 of file sabrvolsurface.cpp.

+ Here is the caller graph for this function:

◆ smileSectionImpl()

ext::shared_ptr< SmileSection > smileSectionImpl ( Time  t) const
overridevirtual

Implements BlackVolSurface.

Definition at line 118 of file sabrvolsurface.cpp.

+ Here is the call graph for this function:

◆ performCalculations()

void performCalculations ( ) const
protected

◆ update()

void update ( )
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.

+ Here is the call graph for this function:

◆ registerWithMarketData()

void registerWithMarketData ( )
private

Definition at line 147 of file sabrvolsurface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkInputs()

void checkInputs ( ) const
private

Definition at line 156 of file sabrvolsurface.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSabrGuesses()

void updateSabrGuesses ( const Date d,
std::array< Real, 4 >  newGuesses 
) const
private

Definition at line 76 of file sabrvolsurface.cpp.

Member Data Documentation

◆ atmCurve_

Handle<BlackAtmVolCurve> atmCurve_
private

Definition at line 88 of file sabrvolsurface.hpp.

◆ optionTenors_

std::vector<Period> optionTenors_
private

Definition at line 89 of file sabrvolsurface.hpp.

◆ optionTimes_

std::vector<Time> optionTimes_
private

Definition at line 90 of file sabrvolsurface.hpp.

◆ optionDates_

std::vector<Date> optionDates_
private

Definition at line 91 of file sabrvolsurface.hpp.

◆ atmRateSpreads_

std::vector<Spread> atmRateSpreads_
private

Definition at line 92 of file sabrvolsurface.hpp.

◆ volSpreads_

std::vector<std::vector<Handle<Quote> > > volSpreads_
private

Definition at line 93 of file sabrvolsurface.hpp.

◆ isAlphaFixed_

bool isAlphaFixed_
private

Definition at line 95 of file sabrvolsurface.hpp.

◆ isBetaFixed_

bool isBetaFixed_
private

Definition at line 96 of file sabrvolsurface.hpp.

◆ isNuFixed_

bool isNuFixed_
private

Definition at line 97 of file sabrvolsurface.hpp.

◆ isRhoFixed_

bool isRhoFixed_
private

Definition at line 98 of file sabrvolsurface.hpp.

◆ vegaWeighted_

bool vegaWeighted_
private

Definition at line 99 of file sabrvolsurface.hpp.

◆ sabrGuesses_

std::vector<std::array<Real,4> > sabrGuesses_
mutableprivate

Definition at line 101 of file sabrvolsurface.hpp.