QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
capflooredinflationcoupon.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2009 Chris Kenyon
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18 */
19
24#ifndef quantlib_capfloored_inflation_coupon_hpp
25#define quantlib_capfloored_inflation_coupon_hpp
26
27#include <ql/cashflows/yoyinflationcoupon.hpp>
28
29namespace QuantLib {
30
32
67 public:
68 // we may watch an underlying coupon ...
70 const ext::shared_ptr<YoYInflationCoupon>& underlying,
73
74 // ... or not
77 const Date& startDate,
78 const Date& endDate,
80 const ext::shared_ptr<YoYInflationIndex>& index,
83 Real gearing = 1.0,
84 Spread spread = 0.0,
85 const Rate cap = Null<Rate>(),
86 const Rate floor = Null<Rate>(),
87 const Date& refPeriodStart = Date(),
88 const Date& refPeriodEnd = Date())
89 : YoYInflationCoupon(paymentDate, nominal, startDate, endDate,
91 gearing, spread, refPeriodStart, refPeriodEnd),
92 isFloored_(false), isCapped_(false) {
93 QL_DEPRECATED_DISABLE_WARNING
95 QL_DEPRECATED_ENABLE_WARNING
96 }
97
99
100
101 Rate rate() const override;
103 Rate cap() const;
105 Rate floor() const;
107 Rate effectiveCap() const;
109 Rate effectiveFloor() const;
111
113
114 void update() override;
116
118
119 void accept(AcyclicVisitor& v) override;
121
123 Rate underlyingRate() const;
124
125 bool isCapped() const { return isCapped_; }
126 bool isFloored() const { return isFloored_; }
127
128 void setPricer(const ext::shared_ptr<YoYInflationCouponPricer>&);
129
130 protected:
131 // to be made private and non-virtual after deprecation, not removed
138 QL_DEPRECATED
139 virtual void setCommon(Rate cap, Rate floor);
140
141 // data, we only use underlying_ if it was constructed that way,
142 // generally we use the shared_ptr conversion to boolean to test
143 ext::shared_ptr<YoYInflationCoupon> underlying_;
146 };
147
148}
149
150#endif
151
degenerate base class for the Acyclic Visitor pattern
Definition: visitor.hpp:33
ext::shared_ptr< YoYInflationCoupon > underlying_
virtual QL_DEPRECATED void setCommon(Rate cap, Rate floor)
void setPricer(const ext::shared_ptr< YoYInflationCouponPricer > &)
Rate effectiveCap() const
effective cap of fixing
Rate underlyingRate() const
this returns the expected rate before cap and floor are applied
Rate effectiveFloor() const
effective floor of fixing
CappedFlooredYoYInflationCoupon(const Date &paymentDate, Real nominal, const Date &startDate, const Date &endDate, Natural fixingDays, const ext::shared_ptr< YoYInflationIndex > &index, const Period &observationLag, const DayCounter &dayCounter, Real gearing=1.0, Spread spread=0.0, const Rate cap=Null< Rate >(), const Rate floor=Null< Rate >(), const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date())
virtual Real nominal() const
Definition: coupon.hpp:100
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Natural fixingDays() const
fixing days
Period observationLag() const
how the coupon observes the index
DayCounter dayCounter() const override
day counter for accrual calculation
const ext::shared_ptr< InflationIndex > & index() const
yoy inflation index
template class providing a null value for a given type.
Definition: null.hpp:76
Coupon paying a YoY-inflation type index
Real gearing() const
index gearing, i.e. multiplicative coefficient for the index
Spread spread() const
spread paid over the fixing of the underlying index
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Real Spread
spreads on interest rates
Definition: types.hpp:74
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35