QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
yoyinflationcoupon.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_newyoy_coupon_hpp
25#define quantlib_newyoy_coupon_hpp
26
27#include <ql/cashflows/inflationcoupon.hpp>
28#include <ql/indexes/inflationindex.hpp>
29#include <ql/time/schedule.hpp>
30
31namespace QuantLib {
32 class YoYInflationCouponPricer;
33
36 public:
37 YoYInflationCoupon(const Date& paymentDate,
39 const Date& startDate,
40 const Date& endDate,
42 const ext::shared_ptr<YoYInflationIndex>& index,
45 Real gearing = 1.0,
46 Spread spread = 0.0,
47 const Date& refPeriodStart = Date(),
48 const Date& refPeriodEnd = Date()
49 );
50
52
53
54 Real gearing() const { return gearing_; }
56 Spread spread() const { return spread_; }
57
58 Rate adjustedFixing() const;
59
60 const ext::shared_ptr<YoYInflationIndex>& yoyIndex() const;
61
63
65 void accept(AcyclicVisitor&) override;
67
68 private:
69 ext::shared_ptr<YoYInflationIndex> yoyIndex_;
70 protected:
71
74 bool checkPricerImpl(const ext::shared_ptr<InflationCouponPricer>&) const override;
75 };
76
77 inline const ext::shared_ptr<YoYInflationIndex>&
79 return yoyIndex_;
80 }
81
83 return (rate()-spread())/gearing();
84 }
85
86
87
88
92 public:
94 Calendar cal,
95 ext::shared_ptr<YoYInflationIndex> index,
96 const Period& observationLag);
98 yoyInflationLeg& withNotionals(const std::vector<Real>& notionals);
102 yoyInflationLeg& withFixingDays(const std::vector<Natural>& fixingDays);
104 yoyInflationLeg& withGearings(const std::vector<Real>& gearings);
106 yoyInflationLeg& withSpreads(const std::vector<Spread>& spreads);
108 yoyInflationLeg& withCaps(const std::vector<Rate>& caps);
110 yoyInflationLeg& withFloors(const std::vector<Rate>& floors);
111 operator Leg() const;
112 private:
114 ext::shared_ptr<YoYInflationIndex> index_;
116 std::vector<Real> notionals_;
120 std::vector<Natural> fixingDays_;
121 std::vector<Real> gearings_;
122 std::vector<Spread> spreads_;
123 std::vector<Rate> caps_, floors_;
124 };
125
126
127
128}
129
130#endif
131
degenerate base class for the Acyclic Visitor pattern
Definition: visitor.hpp:33
calendar class
Definition: calendar.hpp:61
virtual Real nominal() const
Definition: coupon.hpp:100
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Base inflation-coupon class.
Natural fixingDays() const
fixing days
Rate rate() const override
accrued rate
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
Payment schedule.
Definition: schedule.hpp:40
Coupon paying a YoY-inflation type index
bool checkPricerImpl(const ext::shared_ptr< InflationCouponPricer > &) const override
makes sure you were given the correct type of pricer
void accept(AcyclicVisitor &) override
Real gearing() const
index gearing, i.e. multiplicative coefficient for the index
const ext::shared_ptr< YoYInflationIndex > & yoyIndex() const
ext::shared_ptr< YoYInflationIndex > yoyIndex_
Spread spread() const
spread paid over the fixing of the underlying index
BusinessDayConvention paymentAdjustment_
yoyInflationLeg & withSpreads(Spread spread)
yoyInflationLeg & withFloors(Rate floor)
yoyInflationLeg & withPaymentAdjustment(BusinessDayConvention)
ext::shared_ptr< YoYInflationIndex > index_
yoyInflationLeg & withNotionals(Real notional)
yoyInflationLeg & withGearings(Real gearing)
std::vector< Real > notionals_
std::vector< Spread > spreads_
yoyInflationLeg & withPaymentDayCounter(const DayCounter &)
std::vector< Natural > fixingDays_
yoyInflationLeg & withCaps(Rate cap)
yoyInflationLeg & withFixingDays(Natural fixingDays)
BusinessDayConvention
Business Day conventions.
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
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78