QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
analytichestonhullwhiteengine.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) 2007 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 analytichestonhullwhiteengine.hpp
22 \brief analytic heston engine incl. stochastic interest rates
23*/
24
25#ifndef quantlib_analytic_heston_hull_white_engine_hpp
26#define quantlib_analytic_heston_hull_white_engine_hpp
27
31
32namespace QuantLib {
33
34 //! Analytic Heston engine incl. stochastic interest rates
35 /*! This class is pricing a european option under the following process
36
37 \f[
38 \begin{array}{rcl}
39 dS(t, S) &=& (r-d) S dt +\sqrt{v} S dW_1 \\
40 dv(t, S) &=& \kappa (\theta - v) dt + \sigma \sqrt{v} dW_2 \\
41 dr(t) &=& (\theta(t) - a r) dt + \eta dW_3 \\
42 dW_1 dW_2 &=& \rho dt \\
43 dW_1 dW_3 &=& 0 \\
44 dW_2 dW_3 &=& 0 \\
45 \end{array}
46 \f]
47
48 References:
49
50 Karel in't Hout, Joris Bierkens, Antoine von der Ploeg,
51 Joe in't Panhuis, A Semi closed-from analytic pricing formula for
52 call options in a hybrid Heston-Hull-White Model.
53
54 A. Sepp, Pricing European-Style Options under Jump Diffusion
55 Processes with Stochastic Volatility: Applications of Fourier
56 Transform (<http://math.ut.ee/~spartak/papers/stochjumpvols.pdf>)
57
58 \ingroup vanillaengines
59
60 \test the correctness of the returned value is tested by
61 reproducing results available in web/literature, testing
62 against QuantLib's analytic Heston and
63 Black-Scholes-Merton Hull-White engine
64 */
66 public:
67 // see AnalticHestonEninge for usage of different constructors
68 AnalyticHestonHullWhiteEngine(const ext::shared_ptr<HestonModel>& hestonModel,
69 ext::shared_ptr<HullWhite> hullWhiteModel,
70 Size integrationOrder = 144);
71
72 AnalyticHestonHullWhiteEngine(const ext::shared_ptr<HestonModel>& model,
73 ext::shared_ptr<HullWhite> hullWhiteModel,
74 Real relTolerance,
75 Size maxEvaluations);
76
77
78 void update() override;
79 void calculate() const override;
80
81 protected:
82 std::complex<Real> addOnTerm(Real phi, Time t, Size j) const override;
83
84 const ext::shared_ptr<HullWhite> hullWhiteModel_;
85
86 private:
87 void setParameters();
88 mutable Real m_;
89 mutable Real a_, sigma_;
90 };
91
92 inline
94 Time,
95 Size j) const {
96 return std::complex<Real>(-m_*u*u, u*(m_-2*m_*(j-1)));
97 }
98
99}
100
101#endif
analytic Heston-model engine
analytic Heston-model engine based on Fourier transform
Analytic Heston engine incl. stochastic interest rates.
std::complex< Real > addOnTerm(Real phi, Time t, Size j) const override
const ext::shared_ptr< HullWhite > hullWhiteModel_
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
Heston model for the stochastic volatility of an asset.
Hull & White (HW) model.
Definition: any.hpp:35