QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
cpivolatilitystructure.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2009, 2011 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_cpi_volatility_structure_hpp
25#define quantlib_cpi_volatility_structure_hpp
26
27#include <ql/termstructures/voltermstructure.hpp>
28
29namespace QuantLib {
30
32
37 public:
42 const Calendar&,
44 const DayCounter& dc,
48
50
59 Volatility volatility(const Date& maturityDate,
60 Rate strike,
61 const Period &obsLag = Period(-1,Days),
62 bool extrapolate = false) const;
64 Volatility volatility(const Period& optionTenor,
65 Rate strike,
66 const Period &obsLag = Period(-1,Days),
67 bool extrapolate = false) const;
70 Volatility volatility(Time time, Rate strike) const;
71
74
81 virtual Volatility totalVariance(const Date& exerciseDate,
82 Rate strike,
83 const Period &obsLag = Period(-1,Days),
84 bool extrapolate = false) const;
87 virtual Volatility totalVariance(const Period& optionTenor,
88 Rate strike,
89 const Period &obsLag = Period(-1,Days),
90 bool extrapolate = false) const;
92
94
95
100 virtual Period observationLag() const { return observationLag_; }
101 virtual Frequency frequency() const { return frequency_; }
102 virtual bool indexIsInterpolated() const {
104 }
105 virtual Date baseDate() const;
107 virtual Time timeFromBase(const Date &date,
108 const Period& obsLag = Period(-1,Days)) const;
109 // acts as zero time value for boostrapping
110 virtual Volatility baseLevel() const {
111 QL_REQUIRE(baseLevel_ != Null<Volatility>(),
112 "Base volatility, for baseDate(), not set.");
113 return baseLevel_;
114 }
116
118
119
120 Real minStrike() const override = 0;
122 Real maxStrike() const override = 0;
124 protected:
125 virtual void checkRange(const Date&, Rate strike, bool extrapolate) const;
126 virtual void checkRange(Time, Rate strike, bool extrapolate) const;
127
133 Rate strike) const = 0;
134
136 // so you do not need an index
140 };
141
142}
143
144#endif
145
zero inflation (i.e. CPI/RPI/HICP/etc.) volatility structures
Real minStrike() const override=0
the minimum strike for which the term structure can return vols
virtual Volatility volatilityImpl(Time length, Rate strike) const =0
virtual Time timeFromBase(const Date &date, const Period &obsLag=Period(-1, Days)) const
base date will be in the past because of observation lag
virtual Volatility baseLevel() const
virtual void checkRange(const Date &, Rate strike, bool extrapolate) const
virtual Volatility totalVariance(const Date &exerciseDate, Rate strike, const Period &obsLag=Period(-1, Days), bool extrapolate=false) const
Real maxStrike() const override=0
the maximum strike for which the term structure can return vols
Volatility volatility(const Date &maturityDate, Rate strike, const Period &obsLag=Period(-1, Days), bool extrapolate=false) const
Returns the volatility for a given maturity date and strike rate.
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
template class providing a null value for a given type.
Definition: null.hpp:76
virtual Natural settlementDays() const
the settlementDays used for reference date calculation
Volatility term structure.
Frequency
Frequency of events.
Definition: frequency.hpp:37
BusinessDayConvention
Business Day conventions.
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
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
Definition: any.hpp:35