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

Stripped Optionlet Surface. More...

#include <qle/termstructures/datedstrippedoptionlet.hpp>

+ Inheritance diagram for DatedStrippedOptionlet:
+ Collaboration diagram for DatedStrippedOptionlet:

Public Member Functions

 DatedStrippedOptionlet (const Date &referenceDate, const QuantLib::ext::shared_ptr< StrippedOptionletBase > &s)
 Construct from a StrippedOptionletBase object. More...
 
 DatedStrippedOptionlet (const Date &referenceDate, const Calendar &calendar, BusinessDayConvention bdc, const vector< Date > &optionletDates, const vector< vector< Rate > > &strikes, const vector< vector< Volatility > > &volatilities, const vector< Rate > &optionletAtmRates, const DayCounter &dayCounter, VolatilityType type=ShiftedLognormal, Real displacement=0.0)
 Construct from an explicitly provided optionlet surface. More...
 
DatedStrippedOptionletBase interface
const vector< Rate > & optionletStrikes (Size i) const override
 
const vector< Volatility > & optionletVolatilities (Size i) const override
 
const vector< Date > & optionletFixingDates () const override
 
const vector< Time > & optionletFixingTimes () const override
 
Size optionletMaturities () const override
 
const vector< Rate > & atmOptionletRates () const override
 
const Date & referenceDate () const override
 
const Calendar & calendar () const override
 
BusinessDayConvention businessDayConvention () const override
 
const DayCounter & dayCounter () const override
 
VolatilityType volatilityType () const override
 
Real displacement () const override
 
virtual const vector< Rate > & optionletStrikes (Size i) const =0
 
virtual const vector< Volatility > & optionletVolatilities (Size i) const =0
 
virtual const vector< Date > & optionletFixingDates () const =0
 
virtual const vector< Time > & optionletFixingTimes () const =0
 
virtual Size optionletMaturities () const =0
 
virtual const vector< Rate > & atmOptionletRates () const =0
 
virtual const Date & referenceDate () const =0
 
virtual const DayCounter & dayCounter () const =0
 
virtual const Calendar & calendar () const =0
 
virtual BusinessDayConvention businessDayConvention () const =0
 
virtual VolatilityType volatilityType () const =0
 
virtual Real displacement () const =0
 

LazyObject interface

Date referenceDate_
 
Calendar calendar_
 
BusinessDayConvention businessDayConvention_
 
vector< Date > optionletDates_
 
Size nOptionletDates_
 
vector< Time > optionletTimes_
 
vector< vector< Rate > > optionletStrikes_
 
vector< vector< Volatility > > optionletVolatilities_
 
vector< Rate > optionletAtmRates_
 
DayCounter dayCounter_
 
VolatilityType type_
 
Real displacement_
 
void performCalculations () const override
 
void checkInputs () const
 

Detailed Description

Stripped Optionlet Surface.

Class to hold a stripped optionlet surface with a fixed reference date and fixed volatilities

Definition at line 38 of file datedstrippedoptionlet.hpp.

Constructor & Destructor Documentation

◆ DatedStrippedOptionlet() [1/2]

DatedStrippedOptionlet ( const Date &  referenceDate,
const QuantLib::ext::shared_ptr< StrippedOptionletBase > &  s 
)

Construct from a StrippedOptionletBase object.

Definition at line 29 of file datedstrippedoptionlet.cpp.

31 : referenceDate_(referenceDate), calendar_(s->calendar()), businessDayConvention_(s->businessDayConvention()),
32 optionletDates_(s->optionletFixingDates()), nOptionletDates_(s->optionletMaturities()),
33 optionletTimes_(s->optionletFixingTimes()), optionletStrikes_(nOptionletDates_, vector<Rate>()),
34 optionletVolatilities_(nOptionletDates_, vector<Volatility>()), optionletAtmRates_(s->atmOptionletRates()),
35 dayCounter_(s->dayCounter()), type_(s->volatilityType()), displacement_(s->displacement()) {
36
37 // Populate the optionlet strikes and volatilities
38 for (Size i = 0; i < nOptionletDates_; ++i) {
39 optionletStrikes_[i] = s->optionletStrikes(i);
40 optionletVolatilities_[i] = s->optionletVolatilities(i);
41 }
42}
const Date & referenceDate() const override
vector< vector< Volatility > > optionletVolatilities_
vector< vector< Rate > > optionletStrikes_

◆ DatedStrippedOptionlet() [2/2]

DatedStrippedOptionlet ( const Date &  referenceDate,
const Calendar &  calendar,
BusinessDayConvention  bdc,
const vector< Date > &  optionletDates,
const vector< vector< Rate > > &  strikes,
const vector< vector< Volatility > > &  volatilities,
const vector< Rate > &  optionletAtmRates,
const DayCounter &  dayCounter,
VolatilityType  type = ShiftedLognormal,
Real  displacement = 0.0 
)

Construct from an explicitly provided optionlet surface.

Definition at line 44 of file datedstrippedoptionlet.cpp.

52 optionletVolatilities_(volatilities), optionletAtmRates_(optionletAtmRates), dayCounter_(dayCounter), type_(type),
54
56 // Populate the optionlet times
57 for (Size i = 0; i < nOptionletDates_; ++i)
59}
const Calendar & calendar() const override
const DayCounter & dayCounter() const override
vector< Real > strikes
+ Here is the call graph for this function:

Member Function Documentation

◆ optionletStrikes()

const vector< Rate > & optionletStrikes ( Size  i) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 87 of file datedstrippedoptionlet.cpp.

87 {
88 QL_REQUIRE(i < optionletStrikes_.size(),
89 "index (" << i << ") must be less than optionletStrikes size (" << optionletStrikes_.size() << ")");
90 return optionletStrikes_[i];
91}

◆ optionletVolatilities()

const vector< Volatility > & optionletVolatilities ( Size  i) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 93 of file datedstrippedoptionlet.cpp.

93 {
94 QL_REQUIRE(i < optionletVolatilities_.size(), "index (" << i << ") must be less than optionletVolatilities size ("
95 << optionletVolatilities_.size() << ")");
96 return optionletVolatilities_[i];
97}

◆ optionletFixingDates()

const vector< Date > & optionletFixingDates ( ) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 99 of file datedstrippedoptionlet.cpp.

99{ return optionletDates_; }

◆ optionletFixingTimes()

const vector< Time > & optionletFixingTimes ( ) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 101 of file datedstrippedoptionlet.cpp.

101{ return optionletTimes_; }

◆ optionletMaturities()

Size optionletMaturities ( ) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 103 of file datedstrippedoptionlet.cpp.

103{ return nOptionletDates_; }

◆ atmOptionletRates()

const vector< Time > & atmOptionletRates ( ) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 105 of file datedstrippedoptionlet.cpp.

105{ return optionletAtmRates_; }

◆ referenceDate()

const Date & referenceDate ( ) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 111 of file datedstrippedoptionlet.cpp.

111{ return referenceDate_; }

◆ calendar()

const Calendar & calendar ( ) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 109 of file datedstrippedoptionlet.cpp.

109{ return calendar_; }

◆ businessDayConvention()

BusinessDayConvention businessDayConvention ( ) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 113 of file datedstrippedoptionlet.cpp.

113{ return businessDayConvention_; }

◆ dayCounter()

const DayCounter & dayCounter ( ) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 107 of file datedstrippedoptionlet.cpp.

107{ return dayCounter_; }

◆ volatilityType()

VolatilityType volatilityType ( ) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 115 of file datedstrippedoptionlet.cpp.

115{ return type_; }

◆ displacement()

Real displacement ( ) const
overridevirtual

Implements DatedStrippedOptionletBase.

Definition at line 117 of file datedstrippedoptionlet.cpp.

117{ return displacement_; }

◆ performCalculations()

void performCalculations ( ) const
override

Definition at line 70 of file datedstrippedoptionlet.hpp.

70 {
71 // Does nothing unless class becomes more dynamic e.g. take in volatilities as quote handles
72 }

◆ checkInputs()

void checkInputs ( ) const
private

Definition at line 61 of file datedstrippedoptionlet.cpp.

61 {
62
63 QL_REQUIRE(!optionletDates_.empty(), "Need at least one optionlet to create optionlet surface");
64 QL_REQUIRE(nOptionletDates_ == optionletVolatilities_.size(),
65 "Mismatch between number of option tenors (" << nOptionletDates_ << ") and number of volatility rows ("
66 << optionletVolatilities_.size() << ")");
67 QL_REQUIRE(nOptionletDates_ == optionletStrikes_.size(), "Mismatch between number of option tenors ("
68 << nOptionletDates_ << ") and number of strike rows ("
69 << optionletStrikes_.size() << ")");
70 QL_REQUIRE(nOptionletDates_ == optionletAtmRates_.size(), "Mismatch between number of option tenors ("
71 << nOptionletDates_ << ") and number of ATM rates ("
72 << optionletAtmRates_.size() << ")");
73 QL_REQUIRE(optionletDates_[0] > referenceDate_,
74 "First option date (" << optionletDates_[0] << ") must be greater than the reference date");
75 QL_REQUIRE(is_strictly_increasing(optionletDates_.begin(), optionletDates_.end()),
76 "Optionlet dates must be sorted in ascending order");
77
78 for (Size i = 0; i < nOptionletDates_; ++i) {
79 QL_REQUIRE(!optionletStrikes_[i].empty(), "The " << io::ordinal(i) << " row of strikes is empty");
80 QL_REQUIRE(optionletStrikes_[i].size() == optionletVolatilities_[i].size(),
81 "Size of " << io::ordinal(i) << " row of strikes and volatilities are not equal");
82 QL_REQUIRE(is_strictly_increasing(optionletStrikes_[i].begin(), optionletStrikes_[i].end()),
83 "The " << io::ordinal(i) << " row of strikes is not sorted in ascending order");
84 }
85}
+ Here is the caller graph for this function:

Member Data Documentation

◆ referenceDate_

Date referenceDate_
private

Definition at line 78 of file datedstrippedoptionlet.hpp.

◆ calendar_

Calendar calendar_
private

Definition at line 79 of file datedstrippedoptionlet.hpp.

◆ businessDayConvention_

BusinessDayConvention businessDayConvention_
private

Definition at line 80 of file datedstrippedoptionlet.hpp.

◆ optionletDates_

vector<Date> optionletDates_
private

Definition at line 81 of file datedstrippedoptionlet.hpp.

◆ nOptionletDates_

Size nOptionletDates_
private

Definition at line 82 of file datedstrippedoptionlet.hpp.

◆ optionletTimes_

vector<Time> optionletTimes_
private

Definition at line 83 of file datedstrippedoptionlet.hpp.

◆ optionletStrikes_

vector<vector<Rate> > optionletStrikes_
private

Definition at line 84 of file datedstrippedoptionlet.hpp.

◆ optionletVolatilities_

vector<vector<Volatility> > optionletVolatilities_
private

Definition at line 85 of file datedstrippedoptionlet.hpp.

◆ optionletAtmRates_

vector<Rate> optionletAtmRates_
private

Definition at line 86 of file datedstrippedoptionlet.hpp.

◆ dayCounter_

DayCounter dayCounter_
private

Definition at line 87 of file datedstrippedoptionlet.hpp.

◆ type_

VolatilityType type_
private

Definition at line 88 of file datedstrippedoptionlet.hpp.

◆ displacement_

Real displacement_
private

Definition at line 89 of file datedstrippedoptionlet.hpp.