QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
abcd.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006, 2007 Ferdinando Ametrano
5 Copyright (C) 2006 Cristina Duminuco
6 Copyright (C) 2007 Giorgio Facchinetti
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#ifndef quantlib_abcd_hpp
23#define quantlib_abcd_hpp
24
25#include <ql/types.hpp>
26#include <ql/errors.hpp>
27#include <ql/math/abcdmathfunction.hpp>
28
29namespace QuantLib {
30
32
35
36 public:
37 AbcdFunction(Real a = -0.06,
38 Real b = 0.17,
39 Real c = 0.54,
40 Real d = 0.17);
41
43 Real maximumVolatility() const { return maximumValue(); }
44
46 Real shortTermVolatility() const { return (*this)(0.0); }
47
50
53 Real covariance(Time t, Time T, Time S) const;
54
58 Real covariance(Time t1, Time t2, Time T, Time S) const;
59
62 Real volatility(Time tMin, Time tMax, Time T) const;
63
66 Real variance(Time tMin, Time tMax, Time T) const;
67
68
69
70 // INSTANTANEOUS
74
78
82
83 // PRIMITIVE
87 Real primitive(Time t, Time T, Time S) const;
88
89 };
90
91
92 // Helper class used by unit tests
94
95 public:
99 QL_DEPRECATED
101
105 QL_DEPRECATED
107
108 AbcdSquared(Real a, Real b, Real c, Real d, Time T, Time S);
109 Real operator()(Time t) const;
110
111 private:
112 ext::shared_ptr<AbcdFunction> abcd_;
114 };
115
117 AbcdFunction model(a,b,c,d);
118 return model.volatility(0.,u,u);
119 }
120}
121
122#endif
Abcd functional form for instantaneous volatility
Definition: abcd.hpp:34
Real shortTermVolatility() const
volatility function value at time 0:
Definition: abcd.hpp:46
Real covariance(Time t, Time T, Time S) const
Definition: abcd.cpp:43
Real longTermVolatility() const
volatility function value at time +inf:
Definition: abcd.hpp:49
Real maximumVolatility() const
maximum value of the volatility function
Definition: abcd.hpp:43
Real instantaneousVolatility(Time t, Time T) const
Definition: abcd.cpp:61
Real instantaneousCovariance(Time u, Time T, Time S) const
Definition: abcd.cpp:68
Real volatility(Time tMin, Time tMax, Time T) const
Definition: abcd.cpp:32
Real instantaneousVariance(Time t, Time T) const
Definition: abcd.cpp:65
Real primitive(Time t, Time T, Time S) const
Definition: abcd.cpp:73
Real maximumValue() const
maximum value of the function
Real longTermValue() const
function value at time +inf:
ext::shared_ptr< AbcdFunction > abcd_
Definition: abcd.hpp:112
QL_DEPRECATED typedef Real argument_type
Definition: abcd.hpp:100
QL_DEPRECATED typedef Real result_type
Definition: abcd.hpp:106
Real operator()(Time t) const
Definition: abcd.cpp:103
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:35
Real abcdBlackVolatility(Time u, Real a, Real b, Real c, Real d)
Definition: abcd.hpp:116