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

#include <qle/models/yoycapfloorhelper.hpp>

+ Inheritance diagram for YoYCapFloorHelper:
+ Collaboration diagram for YoYCapFloorHelper:

Public Member Functions

 YoYCapFloorHelper (const QuantLib::Handle< QuantLib::Quote > &premium, QuantLib::YoYInflationCapFloor::Type type, QuantLib::Rate strike, QuantLib::Natural settlementDays, const QuantLib::Period &tenor, const QuantLib::ext::shared_ptr< QuantLib::YoYInflationIndex > &yoyIndex, const QuantLib::Period &observationLag, const QuantLib::Calendar &yoyCalendar, QuantLib::BusinessDayConvention yoyConvention, const QuantLib::DayCounter &yoyDayCount, const QuantLib::Calendar &paymentCalendar, QuantLib::BusinessDayConvention paymentConvention, const QuantLib::Period &yoyTenor=1 *QuantLib::Years)
 
CalibrationHelper interface
QuantLib::Real calibrationError () override
 
Observer interface
void update () override
 

YoYCapFloorHelper inspectors

QuantLib::Handle< QuantLib::Quote > premium_
 The market price quote for the YoY cap floor. More...
 
QuantLib::ext::shared_ptr< QuantLib::YoYInflationCapFloor > yoyCapFloor_
 The underlying YoY cap floor. More...
 
QuantLib::ext::shared_ptr< QuantLib::PricingEngine > engine_
 The pricing engine used to value the YoY swap. More...
 
QuantLib::Date evaluationDate_
 
QuantLib::YoYInflationCapFloor::Type type_
 
QuantLib::Rate strike_
 
QuantLib::Natural settlementDays_
 
QuantLib::Period tenor_
 
QuantLib::ext::shared_ptr< QuantLib::YoYInflationIndex > yoyIndex_
 
QuantLib::Period observationLag_
 
QuantLib::Calendar yoyCalendar_
 
QuantLib::BusinessDayConvention yoyConvention_
 
QuantLib::DayCounter yoyDayCount_
 
QuantLib::Calendar paymentCalendar_
 
QuantLib::BusinessDayConvention paymentConvention_
 
QuantLib::Period yoyTenor_
 
QuantLib::ext::shared_ptr< QuantLib::YoYInflationCapFloor > yoyCapFloor () const
 
void setPricingEngine (const QuantLib::ext::shared_ptr< QuantLib::PricingEngine > &engine)
 Set the pricing engine to be used by the underlying YoY cap floor. More...
 
QuantLib::Real marketValue () const
 Return the market premium value. More...
 
QuantLib::Real modelValue () const
 Return the model value. More...
 
void createCapFloor ()
 Create the underlying YoY cap floor. More...
 

Detailed Description

Year on year (YoY) inflation cap floor calibration helper.

Definition at line 35 of file yoycapfloorhelper.hpp.

Constructor & Destructor Documentation

◆ YoYCapFloorHelper()

YoYCapFloorHelper ( const QuantLib::Handle< QuantLib::Quote > &  premium,
QuantLib::YoYInflationCapFloor::Type  type,
QuantLib::Rate  strike,
QuantLib::Natural  settlementDays,
const QuantLib::Period &  tenor,
const QuantLib::ext::shared_ptr< QuantLib::YoYInflationIndex > &  yoyIndex,
const QuantLib::Period &  observationLag,
const QuantLib::Calendar &  yoyCalendar,
QuantLib::BusinessDayConvention  yoyConvention,
const QuantLib::DayCounter &  yoyDayCount,
const QuantLib::Calendar &  paymentCalendar,
QuantLib::BusinessDayConvention  paymentConvention,
const QuantLib::Period &  yoyTenor = 1 * QuantLib::Years 
)

Definition at line 46 of file yoycapfloorhelper.cpp.

59 : premium_(premium),
60 evaluationDate_(Settings::instance().evaluationDate()),
61 type_(type),
62 strike_(strike),
63 settlementDays_(settlementDays),
64 tenor_(tenor),
65 yoyIndex_(yoyIndex),
66 observationLag_(observationLag),
67 yoyCalendar_(yoyCalendar),
68 yoyConvention_(yoyConvention),
69 yoyDayCount_(yoyDayCount),
70 paymentCalendar_(paymentCalendar),
71 paymentConvention_(paymentConvention),
72 yoyTenor_(yoyTenor) {
73
74 registerWith(premium_);
75 registerWith(Settings::instance().evaluationDate());
76 registerWith(yoyIndex_);
77
79}
QuantLib::BusinessDayConvention paymentConvention_
QuantLib::YoYInflationCapFloor::Type type_
QuantLib::DayCounter yoyDayCount_
QuantLib::ext::shared_ptr< QuantLib::YoYInflationIndex > yoyIndex_
QuantLib::BusinessDayConvention yoyConvention_
QuantLib::Handle< QuantLib::Quote > premium_
The market price quote for the YoY cap floor.
QuantLib::Calendar paymentCalendar_
void createCapFloor()
Create the underlying YoY cap floor.
+ Here is the call graph for this function:

Member Function Documentation

◆ calibrationError()

Real calibrationError ( )
override

Definition at line 81 of file yoycapfloorhelper.cpp.

81 {
82 yoyCapFloor_->setPricingEngine(engine_);
83 return premium_->value() - yoyCapFloor_->NPV();
84}
QuantLib::ext::shared_ptr< QuantLib::PricingEngine > engine_
The pricing engine used to value the YoY swap.
QuantLib::ext::shared_ptr< QuantLib::YoYInflationCapFloor > yoyCapFloor_
The underlying YoY cap floor.

◆ update()

void update ( )
override

Definition at line 86 of file yoycapfloorhelper.cpp.

86 {
87 if (evaluationDate_ != Settings::instance().evaluationDate()) {
88 evaluationDate_ = Settings::instance().evaluationDate();
90 }
91 notifyObservers();
92}
+ Here is the call graph for this function:

◆ yoyCapFloor()

QuantLib::ext::shared_ptr< YoYInflationCapFloor > yoyCapFloor ( ) const

Definition at line 94 of file yoycapfloorhelper.cpp.

94 {
95 return yoyCapFloor_;
96}

◆ setPricingEngine()

void setPricingEngine ( const QuantLib::ext::shared_ptr< QuantLib::PricingEngine > &  engine)

Set the pricing engine to be used by the underlying YoY cap floor.

Definition at line 98 of file yoycapfloorhelper.cpp.

98 {
99 engine_ = engine;
100}

◆ marketValue()

QuantLib::Real marketValue ( ) const

Return the market premium value.

Definition at line 102 of file yoycapfloorhelper.cpp.

102 {
103 return premium_->value();
104}

◆ modelValue()

QuantLib::Real modelValue ( ) const

Return the model value.

Definition at line 106 of file yoycapfloorhelper.cpp.

106 {
107 yoyCapFloor_->setPricingEngine(engine_);
108 return yoyCapFloor_->NPV();
109}

◆ createCapFloor()

void createCapFloor ( )
private

Create the underlying YoY cap floor.

Definition at line 111 of file yoycapfloorhelper.cpp.

111 {
112
113 // YoY cap floor start date and end date.
114 auto start = yoyCalendar_.advance(evaluationDate_, settlementDays_ * Days);
115 auto end = start + tenor_;
116
117 // YoY leg schedule.
118 Schedule yoySchedule(start, end, yoyTenor_, yoyCalendar_, yoyConvention_,
119 yoyConvention_, DateGeneration::Backward, false);
120
121 // YoY leg.
122 Leg yoyLeg = yoyInflationLeg(yoySchedule, paymentCalendar_, yoyIndex_, observationLag_)
123 .withNotionals(1.0)
124 .withPaymentDayCounter(yoyDayCount_)
125 .withPaymentAdjustment(paymentConvention_);
126
127 // YoY cap floor.
128 vector<Rate> strikes{ strike_ };
129 yoyCapFloor_ = QuantLib::ext::make_shared<YoYInflationCapFloor>(type_, yoyLeg, strikes);
130}
vector< Real > strikes
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ premium_

QuantLib::Handle<QuantLib::Quote> premium_
private

The market price quote for the YoY cap floor.

Definition at line 80 of file yoycapfloorhelper.hpp.

◆ yoyCapFloor_

QuantLib::ext::shared_ptr<QuantLib::YoYInflationCapFloor> yoyCapFloor_
private

The underlying YoY cap floor.

Definition at line 83 of file yoycapfloorhelper.hpp.

◆ engine_

QuantLib::ext::shared_ptr<QuantLib::PricingEngine> engine_
private

The pricing engine used to value the YoY swap.

Definition at line 86 of file yoycapfloorhelper.hpp.

◆ evaluationDate_

QuantLib::Date evaluationDate_
private

Definition at line 89 of file yoycapfloorhelper.hpp.

◆ type_

QuantLib::YoYInflationCapFloor::Type type_
private

Definition at line 90 of file yoycapfloorhelper.hpp.

◆ strike_

QuantLib::Rate strike_
private

Definition at line 91 of file yoycapfloorhelper.hpp.

◆ settlementDays_

QuantLib::Natural settlementDays_
private

Definition at line 92 of file yoycapfloorhelper.hpp.

◆ tenor_

QuantLib::Period tenor_
private

Definition at line 93 of file yoycapfloorhelper.hpp.

◆ yoyIndex_

QuantLib::ext::shared_ptr<QuantLib::YoYInflationIndex> yoyIndex_
private

Definition at line 94 of file yoycapfloorhelper.hpp.

◆ observationLag_

QuantLib::Period observationLag_
private

Definition at line 95 of file yoycapfloorhelper.hpp.

◆ yoyCalendar_

QuantLib::Calendar yoyCalendar_
private

Definition at line 96 of file yoycapfloorhelper.hpp.

◆ yoyConvention_

QuantLib::BusinessDayConvention yoyConvention_
private

Definition at line 97 of file yoycapfloorhelper.hpp.

◆ yoyDayCount_

QuantLib::DayCounter yoyDayCount_
private

Definition at line 98 of file yoycapfloorhelper.hpp.

◆ paymentCalendar_

QuantLib::Calendar paymentCalendar_
private

Definition at line 99 of file yoycapfloorhelper.hpp.

◆ paymentConvention_

QuantLib::BusinessDayConvention paymentConvention_
private

Definition at line 100 of file yoycapfloorhelper.hpp.

◆ yoyTenor_

QuantLib::Period yoyTenor_
private

Definition at line 101 of file yoycapfloorhelper.hpp.