QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
analytic_discr_geom_av_price_heston.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) 2020 Jack Gillett
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 analytic_discr_geom_av_price_heston.hpp
21 \brief Analytic engine for discrete geometric average price Asian
22 in the Heston model
23*/
24
25#ifndef quantlib_analytic_discrete_geometric_average_price_asian_heston_engine_hpp
26#define quantlib_analytic_discrete_geometric_average_price_asian_heston_engine_hpp
27
31#include <ql/exercise.hpp>
32#include <complex>
33
34namespace QuantLib {
35
36 //! Pricing engine for European discrete geometric average price Asian
37 /*! This class implements a discrete geometric average price
38 Asian option with European exercise under the Heston stochastic
39 vol model where spot and variance follow the processes
40
41 \f[
42 \begin{array}{rcl}
43 dS(t, S) &=& (r-d) S dt +\sqrt{v} S dW_1 \\
44 dv(t, S) &=& \kappa (\theta - v) dt + \sigma \sqrt{v} dW_2 \\
45 dW_1 dW_2 &=& \rho dt \\
46 \end{array}
47 \f]
48
49 References:
50
51 Implements the analytical solution for continuous geometric Asian
52 options developed in "A Recursive Method for Discretely Monitored
53 Geometric Asian Option Prices", B. Kim, J. Kim, J. Kim & I. S. Wee,
54 Bull. Korean Math. Soc. 53, 733-749 (2016)
55
56 \ingroup asianengines
57
58 \test
59 - the correctness of the returned value is tested by reproducing
60 results in Tables 1, 2 and 3 of the paper
61
62 \todo handle seasoned options
63 */
66 public:
68 ext::shared_ptr<HestonProcess> process, Real xiRightLimit = 100.0);
69 void calculate() const override;
70
71 // Equation (21) - must be public so the integrand can access it.
72 std::complex<Real> Phi(std::complex<Real> s,
73 std::complex<Real> w,
74 Time t,
75 Time T,
76 Size kStar,
77 const std::vector<Time>& t_n,
78 const std::vector<Time>& tauK) const;
79
80 private:
81 // Initial process params
86
87 ext::shared_ptr<HestonProcess> process_;
88
89 // A lookup table for the reuslts of omega_tilde() to avoid repeated calls for given Phi call
90 mutable std::map<Size, std::complex<Real> > omegaTildeLookupTable_;
91
92 // Cutoff parameter for integral in Eqs (23) and (24)
94
95 // Integrator for equation (23) and (24)
97
98 // Integrand
99 class Integrand;
100
101 // We need to set up several variables inside calculate as they depend on fixing times. Rather
102 // than pass them between a, omega, F etc. which makes for very messy method signatures, we
103 // make them mutable class properties instead.
104 mutable Real tr_t_;
105 mutable Real Tr_T_;
106 mutable std::vector<Real> tkr_tk_;
107
108 // Equation (11)
109 std::complex<Real> F(const std::complex<Real>& z1,
110 const std::complex<Real>& z2,
111 Time tau) const;
112
113 std::complex<Real> F_tilde(const std::complex<Real>& z1,
114 const std::complex<Real>& z2,
115 Time tau) const;
116
117 // Equation (14)
118 std::complex<Real> z(const std::complex<Real>& s,
119 const std::complex<Real>& w,
120 Size k, Size n) const;
121
122 // Equation (15)
123 std::complex<Real> omega(const std::complex<Real>& s,
124 const std::complex<Real>& w,
125 Size k, Size kStar, Size n) const;
126
127 // Equation (16)
128 std::complex<Real> a(const std::complex<Real>& s,
129 const std::complex<Real>& w,
130 Time t, Time T, Size kStar,
131 const std::vector<Time>& t_n) const;
132
133 // Equation (19)
134 std::complex<Real> omega_tilde(const std::complex<Real>& s,
135 const std::complex<Real>& w,
136 Size k, Size kStar, Size n,
137 const std::vector<Time>& tauK) const;
138 };
139}
140
141
142#endif
Asian option on a single asset.
Pricing engine for European discrete geometric average price Asian.
std::complex< Real > F_tilde(const std::complex< Real > &z1, const std::complex< Real > &z2, Time tau) const
std::complex< Real > omega(const std::complex< Real > &s, const std::complex< Real > &w, Size k, Size kStar, Size n) const
std::complex< Real > z(const std::complex< Real > &s, const std::complex< Real > &w, Size k, Size n) const
std::complex< Real > Phi(std::complex< Real > s, std::complex< Real > w, Time t, Time T, Size kStar, const std::vector< Time > &t_n, const std::vector< Time > &tauK) const
std::complex< Real > a(const std::complex< Real > &s, const std::complex< Real > &w, Time t, Time T, Size kStar, const std::vector< Time > &t_n) const
std::complex< Real > omega_tilde(const std::complex< Real > &s, const std::complex< Real > &w, Size k, Size kStar, Size n, const std::vector< Time > &tauK) const
Discrete-averaging Asian engine base class.
Shared handle to an observable.
Definition: handle.hpp:41
const DefaultType & t
Option exercise classes and payoff function.
Integral of a 1-dimensional function using the Gauss quadratures.
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 stochastic process.
Definition: any.hpp:35
Real F
Definition: sabr.cpp:200