QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
inflationcapfloor.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_instruments_inflationcapfloor_hpp
25#define quantlib_instruments_inflationcapfloor_hpp
26
27#include <ql/instrument.hpp>
28#include <ql/cashflows/yoyinflationcoupon.hpp>
29#include <ql/handle.hpp>
30
31namespace QuantLib {
32
33 class YieldTermStructure;
34
36
56 public:
57 enum Type { Cap, Floor, Collar };
58 class arguments;
59 class engine;
61 Leg yoyLeg,
62 std::vector<Rate> capRates,
63 std::vector<Rate> floorRates);
64 YoYInflationCapFloor(Type type, Leg yoyLeg, const std::vector<Rate>& strikes);
66
67 bool isExpired() const override;
68 void setupArguments(PricingEngine::arguments*) const override;
70
72 Type type() const { return type_; }
73 const std::vector<Rate>& capRates() const { return capRates_; }
74 const std::vector<Rate>& floorRates() const { return floorRates_; }
75 const Leg& yoyLeg() const { return yoyLeg_; }
76
77 Date startDate() const;
78 Date maturityDate() const;
79 ext::shared_ptr<YoYInflationCoupon> lastYoYInflationCoupon() const;
81 ext::shared_ptr<YoYInflationCapFloor> optionlet(Size n) const;
83 virtual Rate atmRate(const YieldTermStructure& discountCurve) const;
86 Real price,
88 Volatility guess,
89 Real accuracy = 1.0e-4,
90 Natural maxEvaluations = 100,
91 Volatility minVol = 1.0e-7,
92 Volatility maxVol = 4.0) const;
93 private:
96 std::vector<Rate> capRates_;
97 std::vector<Rate> floorRates_;
98 };
99
101
103 public:
105 const std::vector<Rate>& exerciseRates)
107 exerciseRates, std::vector<Rate>()) {}
108 };
109
111
113 public:
115 const std::vector<Rate>& exerciseRates)
117 std::vector<Rate>(), exerciseRates) {}
118 };
119
121
123 public:
125 const std::vector<Rate>& capRates,
126 const std::vector<Rate>& floorRates)
129 };
130
131
134 : public virtual PricingEngine::arguments {
135 public:
138 ext::shared_ptr<YoYInflationIndex> index;
140 std::vector<Date> startDates;
141 std::vector<Date> fixingDates;
142 std::vector<Date> payDates;
143 std::vector<Time> accrualTimes;
144 std::vector<Rate> capRates;
145 std::vector<Rate> floorRates;
146 std::vector<Real> gearings;
147 std::vector<Real> spreads;
148 std::vector<Real> nominals;
149 void validate() const override;
150 };
151
154 : public GenericEngine<YoYInflationCapFloor::arguments,
155 YoYInflationCapFloor::results> {};
156
157 std::ostream& operator<<(std::ostream&, YoYInflationCapFloor::Type);
158
159 // inline
160
162 Real,
165 Real,
166 Natural,
168 Volatility) const {
169 QL_FAIL("not implemented yet");
170 }
171
172}
173
174#endif
Concrete cap class.
Definition: capfloor.hpp:108
Concrete collar class.
Definition: capfloor.hpp:128
Concrete date class.
Definition: date.hpp:125
Concrete floor class.
Definition: capfloor.hpp:118
template base class for option pricing engines
Shared handle to an observable.
Definition: handle.hpp:41
Abstract instrument class.
Definition: instrument.hpp:44
Interest-rate term structure.
Arguments for YoY Inflation cap/floor calculation
ext::shared_ptr< YoYInflationIndex > index
base class for cap/floor engines
Base class for yoy inflation cap-like instruments.
virtual Volatility impliedVolatility(Real price, const Handle< YoYInflationTermStructure > &yoyCurve, Volatility guess, Real accuracy=1.0e-4, Natural maxEvaluations=100, Volatility minVol=1.0e-7, Volatility maxVol=4.0) const
implied term volatility
void setupArguments(PricingEngine::arguments *) const override
bool isExpired() const override
returns whether the instrument might have value greater than zero.
const std::vector< Rate > & capRates() const
ext::shared_ptr< YoYInflationCoupon > lastYoYInflationCoupon() const
virtual Rate atmRate(const YieldTermStructure &discountCurve) const
const std::vector< Rate > & floorRates() const
ext::shared_ptr< YoYInflationCapFloor > optionlet(Size n) const
Returns the n-th optionlet as a cap/floor with only one cash flow.
Concrete YoY Inflation cap class.
YoYInflationCap(const Leg &yoyLeg, const std::vector< Rate > &exerciseRates)
Concrete YoY Inflation collar class.
YoYInflationCollar(const Leg &yoyLeg, const std::vector< Rate > &capRates, const std::vector< Rate > &floorRates)
Concrete YoY Inflation floor class.
YoYInflationFloor(const Leg &yoyLeg, const std::vector< Rate > &exerciseRates)
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Real Volatility
volatility
Definition: types.hpp:78
Real Rate
interest rates
Definition: types.hpp:70
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
std::ostream & operator<<(std::ostream &out, GFunctionFactory::YieldCurveModel type)
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78
STL namespace.