Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
nonstandardyoyinflationcoupon.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 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/cashflows/nonstandardyoyinflationcoupon.hpp
20 \brief coupon which generalize the yoy inflation coupon
21 it pays:
22 N * (alpha * I_t/I_s + beta)
23 N * (alpha * (I_t/I_s - 1) + beta)
24 with s<t, if s < today its a ZC Inflation Coupon.
25 \ingroup cashflows
26*/
27
28#ifndef quantext_nonstandardyoycoupon_coupon_hpp
29#define quantext_nonstandardyoycoupon_coupon_hpp
30
31#include <ql/cashflows/inflationcoupon.hpp>
32#include <ql/indexes/inflationindex.hpp>
33#include <ql/time/schedule.hpp>
34
35namespace QuantExt {
36using namespace QuantLib;
37
38//! %Coupon paying a YoY-inflation type index
40public:
41 // This Coupon uses the start and end period to
42 // t = endDate - observationLeg, s = startDate - observationLeg
43 NonStandardYoYInflationCoupon(const Date& paymentDate, Real nominal, const Date& startDate, const Date& endDate,
44 Natural fixingDays, const ext::shared_ptr<ZeroInflationIndex>& index,
45 const Period& observationLag, const DayCounter& dayCounter, Real gearing = 1.0,
46 Spread spread = 0.0, const Date& refPeriodStart = Date(),
47 const Date& refPeriodEnd = Date(), bool addInflationNotional = false,
48 QuantLib::CPI::InterpolationType interpolation = QuantLib::CPI::InterpolationType::Flat);
49
50 //! \name Inspectors
51 //@{
52 //! index gearing, i.e. multiplicative coefficient for the index
53 Real gearing() const { return gearing_; }
54 //! spread paid over the fixing of the underlying index
55 Spread spread() const { return spread_; }
56
57 Rate adjustedFixing() const;
58
59 //@}
60 //! \name Visitability
61 //@{
62 virtual void accept(AcyclicVisitor&) override;
63 //@}
64 virtual Date fixingDateNumerator() const;
65 virtual Date fixingDateDenumerator() const;
66
67 virtual ext::shared_ptr<ZeroInflationIndex> cpiIndex() const;
68
69 virtual Rate indexFixing() const override;
70 virtual Date fixingDate() const override;
71 virtual Rate rate() const override;
72
73 bool addInflationNotional() const;
74 bool isInterpolated() const { return interpolationType() == CPI::Linear; }
75 QuantLib::CPI::InterpolationType interpolationType() const { return interpolationType_; }
76
77protected:
81 Spread spread_;
83 QuantLib::CPI::InterpolationType interpolationType_;
84 bool checkPricerImpl(const ext::shared_ptr<InflationCouponPricer>&) const override;
85
86private:
87 void setFixingDates(const Date& denumatorDate, const Date& numeratorDate, const Period& observationLag);
88};
89
90} // namespace QuantExt
91
92#endif
Coupon paying a YoY-inflation type index
QuantLib::CPI::InterpolationType interpolationType() const
bool checkPricerImpl(const ext::shared_ptr< InflationCouponPricer > &) const override
virtual ext::shared_ptr< ZeroInflationIndex > cpiIndex() const
void setFixingDates(const Date &denumatorDate, const Date &numeratorDate, const Period &observationLag)
virtual void accept(AcyclicVisitor &) override
Real gearing() const
index gearing, i.e. multiplicative coefficient for the index
Spread spread() const
spread paid over the fixing of the underlying index