QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
swaptionconstantvol.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 Ferdinando Ametrano
5 Copyright (C) 2006, 2007 StatPro Italia srl
6 Copyright (C) 2015 Peter Caspers
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
26#ifndef quantlib_swaption_constant_volatility_hpp
27#define quantlib_swaption_constant_volatility_hpp
28
29#include <ql/termstructures/volatility/swaption/swaptionvolstructure.hpp>
30#include <ql/time/period.hpp>
31
32namespace QuantLib {
33
34 class Quote;
35
38 public:
41 const Calendar& cal,
44 const DayCounter& dc,
46 Real shift = 0.0);
49 const Calendar& cal,
52 const DayCounter& dc,
54 Real shift = 0.0);
57 const Calendar& cal,
60 const DayCounter& dc,
62 Real shift = 0.0);
65 const Calendar& cal,
68 const DayCounter& dc,
70 Real shift = 0.0);
72
73 Date maxDate() const override;
75
77 Real minStrike() const override;
78 Real maxStrike() const override;
80
82 const Period& maxSwapTenor() const override;
84
85 VolatilityType volatilityType() const override;
86
87 protected:
88 ext::shared_ptr<SmileSection> smileSectionImpl(const Date&, const Period&) const override;
89 ext::shared_ptr<SmileSection> smileSectionImpl(Time, Time) const override;
90 Volatility volatilityImpl(const Date&, const Period&, Rate) const override;
91 Volatility volatilityImpl(Time, Time, Rate) const override;
92 Real shiftImpl(Time optionTime, Time swapLength) const override;
93
94 private:
99 };
100
101
102 // inline definitions
103
105 return Date::maxDate();
106 }
107
109 return QL_MIN_REAL;
110 }
111
113 return QL_MAX_REAL;
114 }
115
117 return maxSwapTenor_;
118 }
119
121 return volatilityType_;
122 }
123
124 inline Real ConstantSwaptionVolatility::shiftImpl(Time optionTime, Time swapLength) const {
125 // consistency check
127 return shift_;
128 }
129
130}
131
132#endif
calendar class
Definition: calendar.hpp:61
Constant swaption volatility, no time-strike dependence.
Real minStrike() const override
the minimum strike for which the term structure can return vols
Real shiftImpl(Time optionTime, Time swapLength) const override
ext::shared_ptr< SmileSection > smileSectionImpl(const Date &, const Period &) const override
VolatilityType volatilityType() const override
volatility type
Volatility volatilityImpl(const Date &, const Period &, Rate) const override
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
const Period & maxSwapTenor() const override
the largest length for which the term structure can return vols
Concrete date class.
Definition: date.hpp:125
static Date maxDate()
latest allowed date
Definition: date.cpp:771
day counter class
Definition: daycounter.hpp:44
Shared handle to an observable.
Definition: handle.hpp:41
virtual Real shiftImpl(const Date &optionDate, const Period &swapTenor) const
Real shift(const Period &optionTenor, const Period &swapTenor, bool extrapolate=false) const
returns the shift for a given option tenor and swap tenor
Time swapLength(const Period &swapTenor) const
implements the conversion between swap tenor and swap (time) length
Volatility volatility(const Period &optionTenor, const Period &swapTenor, Rate strike, bool extrapolate=false) const
returns the volatility for a given option tenor and swap tenor
virtual Natural settlementDays() const
the settlementDays used for reference date calculation
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
BusinessDayConvention
Business Day conventions.
#define QL_MAX_REAL
Definition: qldefines.hpp:176
#define QL_MIN_REAL
Definition: qldefines.hpp:175
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