QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
swaptionconstantvol.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) 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
22/*! \file swaptionconstantvol.hpp
23 \brief Constant swaption volatility
24*/
25
26#ifndef quantlib_swaption_constant_volatility_hpp
27#define quantlib_swaption_constant_volatility_hpp
28
30#include <ql/time/period.hpp>
31
32namespace QuantLib {
33
34 class Quote;
35
36 //! Constant swaption volatility, no time-strike dependence
38 public:
39 //! floating reference date, floating market data
41 const Calendar& cal,
44 const DayCounter& dc,
46 Real shift = 0.0);
47 //! fixed reference date, floating market data
49 const Calendar& cal,
52 const DayCounter& dc,
54 Real shift = 0.0);
55 //! floating reference date, fixed market data
57 const Calendar& cal,
60 const DayCounter& dc,
62 Real shift = 0.0);
63 //! fixed reference date, fixed market data
65 const Calendar& cal,
68 const DayCounter& dc,
70 Real shift = 0.0);
71 //! \name TermStructure interface
72 //@{
73 Date maxDate() const override;
74 //@}
75 //! \name VolatilityTermStructure interface
76 //@{
77 Real minStrike() const override;
78 Real maxStrike() const override;
79 //@}
80 //! \name SwaptionVolatilityStructure interface
81 //@{
82 const Period& maxSwapTenor() const override;
83 //@}
84 //! volatility type
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
period- and frequency-related classes and enumerations
Swaption volatility structure.