/usr/include/ql/pricingengines/vanilla/batesengine.hpp is in libquantlib0-dev 1.12-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2005 Klaus Spanderen
Copyright (C) 2007 StatPro Italia srl
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<http://quantlib.org/license.shtml>.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
/*! \file batesengine.hpp
\brief analytic Bates model engine
*/
#ifndef quantlib_bates_engine_hpp
#define quantlib_bates_engine_hpp
#include <ql/qldefines.hpp>
#include <ql/models/equity/batesmodel.hpp>
#include <ql/pricingengines/vanilla/analytichestonengine.hpp>
namespace QuantLib {
//! Bates model engines based on Fourier transform
/*! this classes price european options under the following processes
1. Jump-Diffusion with Stochastic Volatility
\f[
\begin{array}{rcl}
dS(t, S) &=& (r-d-\lambda m) S dt +\sqrt{v} S dW_1 + (e^J - 1) S dN \\
dv(t, S) &=& \kappa (\theta - v) dt + \sigma \sqrt{v} dW_2 \\
dW_1 dW_2 &=& \rho dt
\end{array}
\f]
N is a Poisson process with the intensity \f$ \lambda
\f$. When a jump occurs the magnitude J has the probability
density function \f$ \omega(J) \f$.
1.1 Log-Normal Jump Diffusion: BatesEngine
Logarithm of the jump size J is normally distributed
\f[
\omega(J) = \frac{1}{\sqrt{2\pi \delta^2}}
\exp\left[-\frac{(J-\nu)^2}{2\delta^2}\right]
\f]
1.2 Double-Exponential Jump Diffusion: BatesDoubleExpEngine
The jump size has an asymmetric double exponential distribution
\f[
\begin{array}{rcl}
\omega(J)&=& p\frac{1}{\eta_u}e^{-\frac{1}{\eta_u}J} 1_{J>0}
+ q\frac{1}{\eta_d}e^{\frac{1}{\eta_d}J} 1_{J<0} \\
p + q &=& 1
\end{array}
\f]
2. Stochastic Volatility with Jump Diffusion
and Deterministic Jump Intensity
\f[
\begin{array}{rcl}
dS(t, S) &=& (r-d-\lambda m) S dt +\sqrt{v} S dW_1 + (e^J - 1) S dN \\
dv(t, S) &=& \kappa (\theta - v) dt + \sigma \sqrt{v} dW_2 \\
d\lambda(t) &=& \kappa_\lambda(\theta_\lambda-\lambda) dt \\
dW_1 dW_2 &=& \rho dt
\end{array}
\f]
2.1 Log-Normal Jump Diffusion with Deterministic Jump Intensity
BatesDetJumpEngine
2.2 Double-Exponential Jump Diffusion with Deterministic Jump Intensity
BatesDoubleExpDetJumpEngine
References:
D. Bates, Jumps and stochastic volatility: exchange rate processes
implicit in Deutsche mark options,
Review of Financial Sudies 9, 69-107.
A. Sepp, Pricing European-Style Options under Jump Diffusion
Processes with Stochastic Volatility: Applications of Fourier
Transform (<http://math.ut.ee/~spartak/papers/stochjumpvols.pdf>)
\ingroup vanillaengines
\test the correctness of the returned value is tested by
reproducing results available in web/literature, testing
against QuantLib's jump diffusion engine
and comparison with Black pricing.
*/
class BatesEngine : public AnalyticHestonEngine {
public:
BatesEngine(const boost::shared_ptr<BatesModel>& model,
Size integrationOrder = 144);
BatesEngine(const boost::shared_ptr<BatesModel>& model,
Real relTolerance, Size maxEvaluations);
protected:
std::complex<Real> addOnTerm(Real phi, Time t, Size j) const;
};
class BatesDetJumpEngine : public BatesEngine {
public:
BatesDetJumpEngine(const boost::shared_ptr<BatesDetJumpModel>& model,
Size integrationOrder = 144);
BatesDetJumpEngine(const boost::shared_ptr<BatesDetJumpModel>& model,
Real relTolerance, Size maxEvaluations);
protected:
std::complex<Real> addOnTerm(Real phi, Time t, Size j) const;
};
class BatesDoubleExpEngine : public AnalyticHestonEngine {
public:
BatesDoubleExpEngine(
const boost::shared_ptr<BatesDoubleExpModel>& model,
Size integrationOrder = 144);
BatesDoubleExpEngine(
const boost::shared_ptr<BatesDoubleExpModel>& model,
Real relTolerance, Size maxEvaluations);
protected:
std::complex<Real> addOnTerm(Real phi, Time t, Size j) const;
};
class BatesDoubleExpDetJumpEngine : public BatesDoubleExpEngine {
public:
BatesDoubleExpDetJumpEngine(
const boost::shared_ptr<BatesDoubleExpDetJumpModel>& model,
Size integrationOrder = 144);
BatesDoubleExpDetJumpEngine(
const boost::shared_ptr<BatesDoubleExpDetJumpModel>& model,
Real relTolerance, Size maxEvaluations);
protected:
std::complex<Real> addOnTerm(Real phi, Time t, Size j) const;
};
}
#endif
|