Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
BlackMonotoneVarVolTermStructure Class Reference

Black volatility surface that monotonises the variance in an existing surface. More...

#include <qle/termstructures/blackmonotonevarvoltermstructure.hpp>

+ Inheritance diagram for BlackMonotoneVarVolTermStructure:
+ Collaboration diagram for BlackMonotoneVarVolTermStructure:

Classes

class  closeDouble
 

Public Member Functions

 BlackMonotoneVarVolTermStructure (const Handle< BlackVolTermStructure > &vol, const std::vector< Time > &timePoints)
 Constructor takes a BlackVolTermStructure and an array of time points which required monotonic variance. More...
 
const Handle< BlackVolTermStructure > & underlyingVol () const
 return the underlying vol surface More...
 
TermStructure interface
const Date & referenceDate () const override
 
Date maxDate () const override
 
Natural settlementDays () const override
 
Calendar calendar () const override
 
Observer interface
void update () override
 
VolatilityTermStructure interface
Real minStrike () const override
 
Real maxStrike () const override
 

Visitability

Handle< BlackVolTermStructurevol_
 
std::vector< Time > timePoints_
 
std::map< Real, std::vector< Real >, closeDoublemonoVars_
 
virtual void accept (AcyclicVisitor &) override
 
virtual Real blackVarianceImpl (Time t, Real strike) const override
 
virtual Volatility blackVolImpl (Time t, Real strike) const override
 
void setMonotoneVar (const Real &strike) const
 
Real getMonotoneVar (const Time &t, const Real &strike) const
 

Detailed Description

Black volatility surface that monotonises the variance in an existing surface.

This class is used when monotonic variance is required

    \ingroup termstructures

Definition at line 40 of file blackmonotonevarvoltermstructure.hpp.

Constructor & Destructor Documentation

◆ BlackMonotoneVarVolTermStructure()

BlackMonotoneVarVolTermStructure ( const Handle< BlackVolTermStructure > &  vol,
const std::vector< Time > &  timePoints 
)

Constructor takes a BlackVolTermStructure and an array of time points which required monotonic variance.

This will work with both a floating and fixed reference date underlying surface, since we are reimplementing the reference date and update methods

Definition at line 45 of file blackmonotonevarvoltermstructure.hpp.

46 : BlackVolTermStructure(vol->businessDayConvention(), vol->dayCounter()), vol_(vol), timePoints_(timePoints) {
47 registerWith(vol_);
48 }

Member Function Documentation

◆ underlyingVol()

const Handle< BlackVolTermStructure > & underlyingVol ( ) const

return the underlying vol surface

Definition at line 51 of file blackmonotonevarvoltermstructure.hpp.

51{ return vol_; }

◆ referenceDate()

const Date & referenceDate ( ) const
override

Definition at line 55 of file blackmonotonevarvoltermstructure.hpp.

55{ return vol_->referenceDate(); }

◆ maxDate()

Date maxDate ( ) const
override

Definition at line 56 of file blackmonotonevarvoltermstructure.hpp.

56{ return vol_->maxDate(); }

◆ settlementDays()

Natural settlementDays ( ) const
override

Definition at line 57 of file blackmonotonevarvoltermstructure.hpp.

57{ return vol_->settlementDays(); }

◆ calendar()

Calendar calendar ( ) const
override

Definition at line 58 of file blackmonotonevarvoltermstructure.hpp.

58{ return vol_->calendar(); }

◆ update()

void update ( )
override

Definition at line 61 of file blackmonotonevarvoltermstructure.hpp.

61 {
62 monoVars_.clear();
63 notifyObservers();
64 }
std::map< Real, std::vector< Real >, closeDouble > monoVars_

◆ minStrike()

Real minStrike ( ) const
override

Definition at line 68 of file blackmonotonevarvoltermstructure.hpp.

68{ return vol_->minStrike(); }

◆ maxStrike()

Real maxStrike ( ) const
override

Definition at line 69 of file blackmonotonevarvoltermstructure.hpp.

69{ return vol_->maxStrike(); }

◆ accept()

void accept ( AcyclicVisitor &  v)
overridevirtual

Definition at line 113 of file blackmonotonevarvoltermstructure.hpp.

113 {
114 Visitor<BlackMonotoneVarVolTermStructure>* v1 = dynamic_cast<Visitor<BlackMonotoneVarVolTermStructure>*>(&v);
115 if (v1 != 0)
116 v1->visit(*this);
117 else
119}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blackVarianceImpl()

virtual Real blackVarianceImpl ( Time  t,
Real  strike 
) const
overrideprotectedvirtual

Definition at line 76 of file blackmonotonevarvoltermstructure.hpp.

76{ return getMonotoneVar(t, strike); }
Real getMonotoneVar(const Time &t, const Real &strike) const
+ Here is the call graph for this function:

◆ blackVolImpl()

virtual Volatility blackVolImpl ( Time  t,
Real  strike 
) const
overrideprotectedvirtual

Definition at line 77 of file blackmonotonevarvoltermstructure.hpp.

77{ return std::sqrt(getMonotoneVar(t, strike) / t); }
+ Here is the call graph for this function:

◆ setMonotoneVar()

void setMonotoneVar ( const Real &  strike) const
protected

Definition at line 79 of file blackmonotonevarvoltermstructure.hpp.

79 {
80 QL_REQUIRE(timePoints_.size() > 0, "timePoints cannot be empty");
81 std::vector<Real> vars(timePoints_.size());
82 vars[0] = vol_->blackVariance(timePoints_[0], strike);
83 for (Size i = 1; i < timePoints_.size(); i++) {
84 Real var = vol_->blackVariance(timePoints_[i], strike);
85 var = std::max(var, vars[i - 1]);
86 vars[i] = var;
87 }
88 monoVars_[strike] = vars;
89 }
+ Here is the caller graph for this function:

◆ getMonotoneVar()

Real getMonotoneVar ( const Time &  t,
const Real &  strike 
) const
protected

Definition at line 91 of file blackmonotonevarvoltermstructure.hpp.

91 {
92 if (monoVars_.find(strike) == monoVars_.end())
93 setMonotoneVar(strike);
94 BackwardFlatInterpolation interpolation(timePoints_.begin(), timePoints_.end(), monoVars_[strike].begin());
95 return interpolation(t);
96 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ vol_

Handle<BlackVolTermStructure> vol_
private

Definition at line 99 of file blackmonotonevarvoltermstructure.hpp.

◆ timePoints_

std::vector<Time> timePoints_
private

Definition at line 100 of file blackmonotonevarvoltermstructure.hpp.

◆ monoVars_

std::map<Real, std::vector<Real>, closeDouble> monoVars_
mutableprivate

Definition at line 109 of file blackmonotonevarvoltermstructure.hpp.