QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
analyticptdhestonengine.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) 2010, 2017 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 analyticptdhestonengine.hpp
21 \brief analytic piecewise time dependent Heston-model engine
22*/
23
24#ifndef quantlib_analytic_piecewise_time_dependent_heston_engine_hpp
25#define quantlib_analytic_piecewise_time_dependent_heston_engine_hpp
26
30
31
32namespace QuantLib {
33
34 //! analytic piecewise constant time dependent Heston-model engine
35
36 /*! References:
37
38 Heston, Steven L., 1993. A Closed-Form Solution for Options
39 with Stochastic Volatility with Applications to Bond and
40 Currency Options. The review of Financial Studies, Volume 6,
41 Issue 2, 327-343.
42
43 J. Gatheral, The Volatility Surface: A Practitioner's Guide,
44 Wiley Finance
45
46 A. Elices, Models with time-dependent parameters using
47 transform methods: application to Heston’s model,
48 http://arxiv.org/pdf/0708.2020
49
50 \ingroup vanillaengines
51 */
53 : public GenericModelEngine<PiecewiseTimeDependentHestonModel,
54 VanillaOption::arguments,
55 VanillaOption::results> {
56 public:
59
60 // Simple to use constructor: Using adaptive
61 // Gauss-Lobatto integration and Gatheral's version of complex log.
62 // Be aware: using a too large number for maxEvaluations might result
63 // in a stack overflow as the Lobatto integration is a recursive
64 // algorithm.
66 const ext::shared_ptr<PiecewiseTimeDependentHestonModel>& model,
67 Real relTolerance, Size maxEvaluations);
68
69 // Constructor using Laguerre integration
70 // and Gatheral's version of complex log.
72 const ext::shared_ptr<PiecewiseTimeDependentHestonModel>& model,
73 Size integrationOrder = 144);
74
75 // Constructor giving full control over Fourier integration algorithm
77 const ext::shared_ptr<PiecewiseTimeDependentHestonModel>& model,
78 ComplexLogFormula cpxLog,
79 const Integration& itg,
80 Real andersenPiterbargEpsilon = 1e-8);
81
82
83 void calculate() const override;
85
86 // normalized characteristic function
87 std::complex<Real> chF(const std::complex<Real>& z, Time t) const;
88 std::complex<Real> lnChF(const std::complex<Real>& z, Time t) const;
89
90 private:
91 class Fj_Helper;
92 class AP_Helper;
93
96 const ext::shared_ptr<Integration> integration_;
98 };
99}
100
101#endif
analytic Heston-model engine
analytic piecewise constant time dependent Heston-model engine
std::complex< Real > lnChF(const std::complex< Real > &z, Time t) const
AnalyticHestonEngine::Integration Integration
const ext::shared_ptr< Integration > integration_
std::complex< Real > chF(const std::complex< Real > &z, Time t) const
Base class for some pricing engine on a particular model.
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
piecewise constant time dependent Heston-model
Vanilla option on a single asset.