| 1 | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 | |
| 3 | /* |
| 4 | Copyright (C) 2008 Klaus Spanderen |
| 5 | |
| 6 | This file is part of QuantLib, a free-software/open-source library |
| 7 | for financial quantitative analysts and developers - http://quantlib.org/ |
| 8 | |
| 9 | QuantLib is free software: you can redistribute it and/or modify it |
| 10 | under the terms of the QuantLib license. You should have received a |
| 11 | copy of the license along with this program; if not, please email |
| 12 | <quantlib-dev@lists.sf.net>. The license is also available online at |
| 13 | <http://quantlib.org/license.shtml>. |
| 14 | |
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 17 | FOR A PARTICULAR PURPOSE. See the license for more details. |
| 18 | */ |
| 19 | |
| 20 | /*! \file batesprocess.hpp |
| 21 | \brief Bates stochastic process, Heston process plus compound Poisson |
| 22 | process plus log-normal jump diffusion size |
| 23 | */ |
| 24 | |
| 25 | #ifndef quantlib_bates_process_hpp |
| 26 | #define quantlib_bates_process_hpp |
| 27 | |
| 28 | #include <ql/processes/hestonprocess.hpp> |
| 29 | #include <ql/math/distributions/normaldistribution.hpp> |
| 30 | |
| 31 | |
| 32 | namespace QuantLib { |
| 33 | |
| 34 | //! Square-root stochastic-volatility Bates process |
| 35 | /*! This class describes the square root stochastic volatility |
| 36 | process incl jumps governed by |
| 37 | \f[ |
| 38 | \begin{array}{rcl} |
| 39 | dS(t, S) &=& (r-d-\lambda m) S dt +\sqrt{v} S dW_1 + (e^J - 1) S dN \\ |
| 40 | dv(t, S) &=& \kappa (\theta - v) dt + \sigma \sqrt{v} dW_2 \\ |
| 41 | dW_1 dW_2 &=& \rho dt \\ |
| 42 | \omega(J) &=& \frac{1}{\sqrt{2\pi \delta^2}} |
| 43 | \exp\left[-\frac{(J-\nu)^2}{2\delta^2}\right] |
| 44 | \end{array} |
| 45 | \f] |
| 46 | |
| 47 | \ingroup processes |
| 48 | */ |
| 49 | class BatesProcess : public HestonProcess { |
| 50 | public: |
| 51 | BatesProcess(const Handle<YieldTermStructure>& riskFreeRate, |
| 52 | const Handle<YieldTermStructure>& dividendYield, |
| 53 | const Handle<Quote>& s0, |
| 54 | Real v0, Real kappa, |
| 55 | Real theta, Real sigma, Real rho, |
| 56 | Real lambda, Real nu, Real delta, |
| 57 | HestonProcess::Discretization d |
| 58 | = HestonProcess::FullTruncation); |
| 59 | |
| 60 | Size factors() const override; |
| 61 | Array drift(Time t, const Array& x) const override; |
| 62 | Array evolve(Time t0, const Array& x0, Time dt, const Array& dw) const override; |
| 63 | |
| 64 | Real lambda() const; |
| 65 | Real nu() const; |
| 66 | Real delta() const; |
| 67 | private: |
| 68 | const Real lambda_, delta_, nu_, m_; |
| 69 | const CumulativeNormalDistribution cumNormalDist_; |
| 70 | }; |
| 71 | } |
| 72 | |
| 73 | |
| 74 | #endif |
| 75 | |