QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
capletvariancecurve.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2005 Klaus Spanderen
5 Copyright (C) 2015 Peter Caspers
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
21/*! \file capletvariancecurve.hpp
22 \brief caplet variance curve
23*/
24
25#ifndef quantlib_caplet_variance_curve_hpp
26#define quantlib_caplet_variance_curve_hpp
27
31
32namespace QuantLib {
33
35 public:
37 const std::vector< Date > &dates,
38 const std::vector< Volatility > &capletVolCurve,
41 Real displacement = 0.0);
42 //! \name TermStructure interface
43 //@{
44 DayCounter dayCounter() const override;
45 Date maxDate() const override;
46 //@}
47 Real minStrike() const override;
48 Real maxStrike() const override;
49 VolatilityType volatilityType() const override;
50 Real displacement() const override;
51
52 protected:
53 ext::shared_ptr<SmileSection> smileSectionImpl(Time t) const override;
54 Volatility volatilityImpl(Time t, Rate) const override;
55
56 private:
60 };
61
63 const Date &referenceDate, const std::vector< Date > &dates,
64 const std::vector< Volatility > &capletVolCurve,
65 const DayCounter &dayCounter, VolatilityType type, Real displacement)
67 blackCurve_(referenceDate, dates, capletVolCurve, dayCounter, false),
68 type_(type), displacement_(displacement) {}
69
71 return blackCurve_.dayCounter();
72 }
73
75 return blackCurve_.maxDate();
76 }
77
79 return blackCurve_.minStrike();
80 }
81
83 return blackCurve_.maxStrike();
84 }
85
86 inline ext::shared_ptr<SmileSection>
88 // dummy strike
89 Volatility atmVol = blackCurve_.blackVol(t, 0.05, true);
90 return ext::make_shared<FlatSmileSection>(t, atmVol, dayCounter());
91 }
92
93 inline
95 return blackCurve_.blackVol(t, r, true);
96 }
97
99 return type_;
100 }
101
103 return displacement_;
104 }
105}
106
107#endif
Black volatility curve modelled as variance curve.
Black volatility curve modelled as variance curve.
Real minStrike() const override
the minimum strike for which the term structure can return vols
DayCounter dayCounter() const override
the day counter used for date/time conversion
Date maxDate() const override
the latest date for which the curve can return values
Real maxStrike() const override
the maximum strike for which the term structure can return vols
Volatility blackVol(const Date &maturity, Real strike, bool extrapolate=false) const
spot volatility
calendar class
Definition: calendar.hpp:61
CapletVarianceCurve(const Date &referenceDate, const std::vector< Date > &dates, const std::vector< Volatility > &capletVolCurve, const DayCounter &dayCounter, VolatilityType type=ShiftedLognormal, Real displacement=0.0)
Volatility volatilityImpl(Time t, Rate) const override
implements the actual volatility calculation in derived classes
Real minStrike() const override
the minimum strike for which the term structure can return vols
ext::shared_ptr< SmileSection > smileSectionImpl(Time t) const override
implements the actual smile calculation in derived classes
VolatilityType volatilityType() const override
DayCounter dayCounter() const override
the day counter used for date/time conversion
Date maxDate() const override
the latest date for which the curve can return values
Real maxStrike() const override
the maximum strike for which the term structure can return vols
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Optionlet (caplet/floorlet) volatility structure.
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
const DefaultType & t
Flat SmileSection.
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Real Volatility
volatility
Definition: types.hpp:78
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35
optionlet (caplet/floorlet) volatility structure
ext::shared_ptr< YieldTermStructure > r