Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
yoyswaphelper.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/yoyswaphelper.hpp
20 \brief Year on year inflation swap calibration helper
21 \ingroup models
22*/
23
24#ifndef quantext_yoy_swap_helper_hpp
25#define quantext_yoy_swap_helper_hpp
26
27#include <ql/instruments/yearonyearinflationswap.hpp>
28#include <ql/models/calibrationhelper.hpp>
29
30namespace QuantExt {
31
32/*! Year on year (YoY) inflation swap calibration helper.
33 \ingroup models
34*/
35class YoYSwapHelper : public QuantLib::CalibrationHelper, public QuantLib::Observer, public QuantLib::Observable {
36public:
37 //! Year on year helper constructor
38 YoYSwapHelper(const QuantLib::Handle<QuantLib::Quote>& rate,
39 QuantLib::Natural settlementDays,
40 const QuantLib::Period& tenor,
41 const QuantLib::ext::shared_ptr<QuantLib::YoYInflationIndex>& yoyIndex,
42 const QuantLib::Handle<QuantLib::YieldTermStructure>& rateCurve,
43 const QuantLib::Period& observationLag,
44 const QuantLib::Calendar& yoyCalendar,
45 QuantLib::BusinessDayConvention yoyConvention,
46 const QuantLib::DayCounter& yoyDayCount,
47 const QuantLib::Calendar& fixedCalendar,
48 QuantLib::BusinessDayConvention fixedConvention,
49 const QuantLib::DayCounter& fixedDayCount,
50 const QuantLib::Calendar& paymentCalendar,
51 QuantLib::BusinessDayConvention paymentConvention,
52 const QuantLib::Period& fixedTenor = 1 * QuantLib::Years,
53 const QuantLib::Period& yoyTenor = 1 * QuantLib::Years);
54
55 //! \name CalibrationHelper interface
56 //@{
57 QuantLib::Real calibrationError() override;
58 //@}
59
60 //! \name Observer interface
61 //@{
62 void update() override;
63 //@}
64
65 //! \name YoYSwapHelper inspectors
66 //@{
67 QuantLib::ext::shared_ptr<QuantLib::YearOnYearInflationSwap> yoySwap() const;
68 //@}
69
70 //! Set the pricing engine to be used by the underlying YoY swap
71 void setPricingEngine(const QuantLib::ext::shared_ptr<QuantLib::PricingEngine>& engine);
72
73 //! Return the market fair year on year rate
74 QuantLib::Real marketRate() const;
75
76 //! Return the model implied fair year on year rate
77 QuantLib::Real modelRate() const;
78
79private:
80 //! Create the underlying YoY swap
81 void createSwap();
82
83 //! The YoY market swap quote
84 QuantLib::Handle<QuantLib::Quote> rate_;
85
86 //! The underlying YoY swap
87 QuantLib::ext::shared_ptr<QuantLib::YearOnYearInflationSwap> yoySwap_;
88
89 //! The pricing engine used to value the YoY swap
90 QuantLib::ext::shared_ptr<QuantLib::PricingEngine> engine_;
91
92 // Store variables needed to rebuild the YoY swap
93 QuantLib::Date evaluationDate_;
94 QuantLib::Natural settlementDays_;
95 QuantLib::Period tenor_;
96 QuantLib::ext::shared_ptr<QuantLib::YoYInflationIndex> yoyIndex_;
97 QuantLib::Handle<QuantLib::YieldTermStructure> rateCurve_;
98 QuantLib::Period observationLag_;
99 QuantLib::Calendar yoyCalendar_;
100 QuantLib::BusinessDayConvention yoyConvention_;
101 QuantLib::DayCounter yoyDayCount_;
102 QuantLib::Calendar fixedCalendar_;
103 QuantLib::BusinessDayConvention fixedConvention_;
104 QuantLib::DayCounter fixedDayCount_;
105 QuantLib::Calendar paymentCalendar_;
106 QuantLib::BusinessDayConvention paymentConvention_;
107 QuantLib::Period fixedTenor_;
108 QuantLib::Period yoyTenor_;
109};
110
111}
112
113#endif
QuantLib::DayCounter fixedDayCount_
QuantLib::Period observationLag_
QuantLib::Real modelRate() const
Return the model implied fair year on year rate.
QuantLib::ext::shared_ptr< QuantLib::PricingEngine > engine_
The pricing engine used to value the YoY swap.
QuantLib::BusinessDayConvention paymentConvention_
QuantLib::Period yoyTenor_
QuantLib::Period fixedTenor_
void update() override
QuantLib::Real marketRate() const
Return the market fair year on year rate.
QuantLib::ext::shared_ptr< QuantLib::YearOnYearInflationSwap > yoySwap() const
QuantLib::Date evaluationDate_
QuantLib::ext::shared_ptr< QuantLib::YearOnYearInflationSwap > yoySwap_
The underlying YoY swap.
void createSwap()
Create the underlying YoY swap.
QuantLib::Real calibrationError() override
QuantLib::DayCounter yoyDayCount_
QuantLib::Natural settlementDays_
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 swap.
QuantLib::Calendar paymentCalendar_
QuantLib::BusinessDayConvention fixedConvention_
QuantLib::Handle< QuantLib::YieldTermStructure > rateCurve_
QuantLib::Calendar yoyCalendar_
QuantLib::Handle< QuantLib::Quote > rate_
The YoY market swap quote.
QuantLib::Calendar fixedCalendar_
QuantLib::Period tenor_