Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
yoycapfloorhelper.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file qle/models/yoycapfloorhelper.hpp
20 \brief Year on year inflation cap floor calibration helper
21 \ingroup models
22*/
23
24#ifndef quantext_yoycapfloor_helper_hpp
25#define quantext_yoycapfloor_helper_hpp
26
27#include <ql/instruments/inflationcapfloor.hpp>
28#include <ql/models/calibrationhelper.hpp>
29
30namespace QuantExt {
31
32/*! Year on year (YoY) inflation cap floor calibration helper.
33 \ingroup models
34*/
35class YoYCapFloorHelper : public QuantLib::CalibrationHelper, public QuantLib::Observer, public QuantLib::Observable {
36public:
37 YoYCapFloorHelper(const QuantLib::Handle<QuantLib::Quote>& premium,
38 QuantLib::YoYInflationCapFloor::Type type,
39 QuantLib::Rate strike,
40 QuantLib::Natural settlementDays,
41 const QuantLib::Period& tenor,
42 const QuantLib::ext::shared_ptr<QuantLib::YoYInflationIndex>& yoyIndex,
43 const QuantLib::Period& observationLag,
44 const QuantLib::Calendar& yoyCalendar,
45 QuantLib::BusinessDayConvention yoyConvention,
46 const QuantLib::DayCounter& yoyDayCount,
47 const QuantLib::Calendar& paymentCalendar,
48 QuantLib::BusinessDayConvention paymentConvention,
49 const QuantLib::Period& yoyTenor = 1 * QuantLib::Years);
50
51 //! \name CalibrationHelper interface
52 //@{
53 QuantLib::Real calibrationError() override;
54 //@}
55
56 //! \name Observer interface
57 //@{
58 void update() override;
59 //@}
60
61 //! \name YoYCapFloorHelper inspectors
62 //@{
63 QuantLib::ext::shared_ptr<QuantLib::YoYInflationCapFloor> yoyCapFloor() const;
64 //@}
65
66 //! Set the pricing engine to be used by the underlying YoY cap floor
67 void setPricingEngine(const QuantLib::ext::shared_ptr<QuantLib::PricingEngine>& engine);
68
69 //! Return the market premium value
70 QuantLib::Real marketValue() const;
71
72 //! Return the model value
73 QuantLib::Real modelValue() const;
74
75private:
76 //! Create the underlying YoY cap floor
77 void createCapFloor();
78
79 //! The market price quote for the YoY cap floor
80 QuantLib::Handle<QuantLib::Quote> premium_;
81
82 //! The underlying YoY cap floor
83 QuantLib::ext::shared_ptr<QuantLib::YoYInflationCapFloor> yoyCapFloor_;
84
85 //! The pricing engine used to value the YoY swap
86 QuantLib::ext::shared_ptr<QuantLib::PricingEngine> engine_;
87
88 // Store variables needed to rebuild the YoY cap floor
89 QuantLib::Date evaluationDate_;
90 QuantLib::YoYInflationCapFloor::Type type_;
91 QuantLib::Rate strike_;
92 QuantLib::Natural settlementDays_;
93 QuantLib::Period tenor_;
94 QuantLib::ext::shared_ptr<QuantLib::YoYInflationIndex> yoyIndex_;
95 QuantLib::Period observationLag_;
96 QuantLib::Calendar yoyCalendar_;
97 QuantLib::BusinessDayConvention yoyConvention_;
98 QuantLib::DayCounter yoyDayCount_;
99 QuantLib::Calendar paymentCalendar_;
100 QuantLib::BusinessDayConvention paymentConvention_;
101 QuantLib::Period yoyTenor_;
102};
103
104}
105
106#endif
QuantLib::Real modelValue() const
Return the model value.
QuantLib::Real marketValue() const
Return the market premium value.
QuantLib::ext::shared_ptr< QuantLib::PricingEngine > engine_
The pricing engine used to value the YoY swap.
QuantLib::BusinessDayConvention paymentConvention_
QuantLib::YoYInflationCapFloor::Type type_
QuantLib::Real calibrationError() override
QuantLib::DayCounter yoyDayCount_
QuantLib::ext::shared_ptr< QuantLib::YoYInflationCapFloor > yoyCapFloor_
The underlying YoY cap floor.
QuantLib::ext::shared_ptr< QuantLib::YoYInflationIndex > yoyIndex_
QuantLib::BusinessDayConvention yoyConvention_
void setPricingEngine(const QuantLib::ext::shared_ptr< QuantLib::PricingEngine > &engine)
Set the pricing engine to be used by the underlying YoY cap floor.
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.
QuantLib::ext::shared_ptr< QuantLib::YoYInflationCapFloor > yoyCapFloor() const