QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
batesengine.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) 2007 StatPro Italia srl
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 batesengine.hpp
22 \brief analytic Bates model engine
23*/
24
25#ifndef quantlib_bates_engine_hpp
26#define quantlib_bates_engine_hpp
27
28#include <ql/qldefines.hpp>
31
32namespace QuantLib {
33
34 //! Bates model engines based on Fourier transform
35 /*! this classes price european options under the following processes
36
37 1. Jump-Diffusion with Stochastic Volatility
38
39 \f[
40 \begin{array}{rcl}
41 dS(t, S) &=& (r-d-\lambda m) S dt +\sqrt{v} S dW_1 + (e^J - 1) S dN \\
42 dv(t, S) &=& \kappa (\theta - v) dt + \sigma \sqrt{v} dW_2 \\
43 dW_1 dW_2 &=& \rho dt
44 \end{array}
45 \f]
46
47 N is a Poisson process with the intensity \f$ \lambda
48 \f$. When a jump occurs the magnitude J has the probability
49 density function \f$ \omega(J) \f$.
50
51 1.1 Log-Normal Jump Diffusion: BatesEngine
52
53 Logarithm of the jump size J is normally distributed
54 \f[
55 \omega(J) = \frac{1}{\sqrt{2\pi \delta^2}}
56 \exp\left[-\frac{(J-\nu)^2}{2\delta^2}\right]
57 \f]
58
59 1.2 Double-Exponential Jump Diffusion: BatesDoubleExpEngine
60
61 The jump size has an asymmetric double exponential distribution
62 \f[
63 \begin{array}{rcl}
64 \omega(J)&=& p\frac{1}{\eta_u}e^{-\frac{1}{\eta_u}J} 1_{J>0}
65 + q\frac{1}{\eta_d}e^{\frac{1}{\eta_d}J} 1_{J<0} \\
66 p + q &=& 1
67 \end{array}
68 \f]
69
70 2. Stochastic Volatility with Jump Diffusion
71 and Deterministic Jump Intensity
72
73 \f[
74 \begin{array}{rcl}
75 dS(t, S) &=& (r-d-\lambda m) S dt +\sqrt{v} S dW_1 + (e^J - 1) S dN \\
76 dv(t, S) &=& \kappa (\theta - v) dt + \sigma \sqrt{v} dW_2 \\
77 d\lambda(t) &=& \kappa_\lambda(\theta_\lambda-\lambda) dt \\
78 dW_1 dW_2 &=& \rho dt
79 \end{array}
80 \f]
81
82 2.1 Log-Normal Jump Diffusion with Deterministic Jump Intensity
83 BatesDetJumpEngine
84
85 2.2 Double-Exponential Jump Diffusion with Deterministic Jump Intensity
86 BatesDoubleExpDetJumpEngine
87
88
89 References:
90
91 D. Bates, Jumps and stochastic volatility: exchange rate processes
92 implicit in Deutsche mark options,
93 Review of Financial Sudies 9, 69-107.
94
95 A. Sepp, Pricing European-Style Options under Jump Diffusion
96 Processes with Stochastic Volatility: Applications of Fourier
97 Transform (<http://math.ut.ee/~spartak/papers/stochjumpvols.pdf>)
98
99 \ingroup vanillaengines
100
101 \test the correctness of the returned value is tested by
102 reproducing results available in web/literature, testing
103 against QuantLib's jump diffusion engine
104 and comparison with Black pricing.
105 */
107 public:
108 explicit BatesEngine(const ext::shared_ptr<BatesModel>& model,
109 Size integrationOrder = 144);
110 BatesEngine(const ext::shared_ptr<BatesModel>& model,
111 Real relTolerance, Size maxEvaluations);
112
113 protected:
114 std::complex<Real> addOnTerm(Real phi, Time t, Size j) const override;
115 };
116
117
119 public:
120 explicit BatesDetJumpEngine(const ext::shared_ptr<BatesDetJumpModel>& model,
121 Size integrationOrder = 144);
122 BatesDetJumpEngine(const ext::shared_ptr<BatesDetJumpModel>& model,
123 Real relTolerance, Size maxEvaluations);
124
125 protected:
126 std::complex<Real> addOnTerm(Real phi, Time t, Size j) const override;
127 };
128
129
131 public:
132 explicit BatesDoubleExpEngine(
133 const ext::shared_ptr<BatesDoubleExpModel>& model,
134 Size integrationOrder = 144);
136 const ext::shared_ptr<BatesDoubleExpModel>& model,
137 Real relTolerance, Size maxEvaluations);
138
139 protected:
140 std::complex<Real> addOnTerm(Real phi, Time t, Size j) const override;
141 };
142
143
145 public:
147 const ext::shared_ptr<BatesDoubleExpDetJumpModel>& model,
148 Size integrationOrder = 144);
150 const ext::shared_ptr<BatesDoubleExpDetJumpModel>& model,
151 Real relTolerance, Size maxEvaluations);
152
153 protected:
154 std::complex<Real> addOnTerm(Real phi, Time t, Size j) const override;
155 };
156
157}
158
159#endif
analytic Heston-model engine
extended versions of the Heston model
analytic Heston-model engine based on Fourier transform
std::complex< Real > addOnTerm(Real phi, Time t, Size j) const override
Definition: batesengine.cpp:67
std::complex< Real > addOnTerm(Real phi, Time t, Size j) const override
std::complex< Real > addOnTerm(Real phi, Time t, Size j) const override
Bates model engines based on Fourier transform.
std::complex< Real > addOnTerm(Real phi, Time t, Size j) const override
Definition: batesengine.cpp:39
const DefaultType & t
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
Global definitions and compiler switches.