QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
yearonyearinflationswap.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2007, 2009 Chris Kenyon
5 Copyright (C) 2009 StatPro Italia srl
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19 */
20
25#ifndef quantlib_yyiis_hpp
26#define quantlib_yyiis_hpp
27
28#include <ql/instruments/swap.hpp>
29#include <ql/time/calendar.hpp>
30#include <ql/time/daycounter.hpp>
31#include <ql/time/schedule.hpp>
32
33namespace QuantLib {
34 class YoYInflationIndex;
35
37
48 public:
49 class arguments;
50 class results;
51 class engine;
53 Type type,
59 ext::shared_ptr<YoYInflationIndex> yoyIndex,
63 Calendar paymentCalendar, // inflation index does not have a calendar
65 // results
66 virtual Real fixedLegNPV() const;
67 virtual Rate fairRate() const;
68
69 virtual Real yoyLegNPV() const;
70 virtual Spread fairSpread() const;
71 // inspectors
72 virtual Type type() const;
73 virtual Real nominal() const;
74
75 virtual const Schedule& fixedSchedule() const;
76 virtual Rate fixedRate() const;
77 virtual const DayCounter& fixedDayCount() const;
78
79 virtual const Schedule& yoySchedule() const;
80 virtual const ext::shared_ptr<YoYInflationIndex>& yoyInflationIndex() const;
81 virtual Period observationLag() const { return observationLag_; }
82 virtual Spread spread() const;
83 virtual const DayCounter& yoyDayCount() const;
84
85 virtual Calendar paymentCalendar() const { return paymentCalendar_; }
87
88 virtual const Leg& fixedLeg() const;
89 virtual const Leg& yoyLeg() const;
90
91 // other
92 void setupArguments(PricingEngine::arguments* args) const override;
93 void fetchResults(const PricingEngine::results*) const override;
94 ~YearOnYearInflationSwap() override = default;
95
96 private:
97 void setupExpired() const override;
104 ext::shared_ptr<YoYInflationIndex> yoyIndex_;
110 // results
113 };
114
115
118 public:
122
123 std::vector<Date> fixedResetDates;
124 std::vector<Date> fixedPayDates;
125 std::vector<Time> yoyAccrualTimes;
126 std::vector<Date> yoyResetDates;
127 std::vector<Date> yoyFixingDates;
128 std::vector<Date> yoyPayDates;
129
130 std::vector<Real> fixedCoupons;
131 std::vector<Spread> yoySpreads;
132 std::vector<Real> yoyCoupons;
133 void validate() const override;
134 };
135
138 public:
141 void reset() override;
142 };
143
144 class YearOnYearInflationSwap::engine : public GenericEngine<YearOnYearInflationSwap::arguments,
145 YearOnYearInflationSwap::results> {};
146
147
148 // inline definitions
149
151 return type_;
152 }
153
155 return nominal_;
156 }
157
159 return fixedSchedule_;
160 }
161
163 return fixedRate_;
164 }
165
167 return fixedDayCount_;
168 }
169
171 return yoySchedule_;
172 }
173
174 inline const ext::shared_ptr<YoYInflationIndex>& YearOnYearInflationSwap::yoyInflationIndex() const {
175 return yoyIndex_;
176 }
177
179 return spread_;
180 }
181
183 return yoyDayCount_;
184 }
185
187 return paymentConvention_;
188 }
189
191 return legs_[0];
192 }
193
194 inline const Leg& YearOnYearInflationSwap::yoyLeg() const {
195 return legs_[1];
196 }
197
198}
199
200#endif
201
calendar class
Definition: calendar.hpp:61
day counter class
Definition: daycounter.hpp:44
template base class for option pricing engines
template class providing a null value for a given type.
Definition: null.hpp:76
Payment schedule.
Definition: schedule.hpp:40
Interest rate swap.
Definition: swap.hpp:41
std::vector< Leg > legs_
Definition: swap.hpp:133
Year-on-year inflation-indexed swap.
virtual const ext::shared_ptr< YoYInflationIndex > & yoyInflationIndex() const
virtual const DayCounter & fixedDayCount() const
virtual BusinessDayConvention paymentConvention() const
virtual const Schedule & fixedSchedule() const
~YearOnYearInflationSwap() override=default
virtual const Schedule & yoySchedule() const
void setupArguments(PricingEngine::arguments *args) const override
void fetchResults(const PricingEngine::results *) const override
virtual const DayCounter & yoyDayCount() const
ext::shared_ptr< YoYInflationIndex > yoyIndex_
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
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