QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
analyticgjrgarchengine.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) 2008 Yee Man Chan
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 analyticgjrgarchengine.hpp
21 \brief analytic GJR-GARCH-model engine
22*/
23
24#ifndef quantlib_analytic_gjrgarch_engine_hpp
25#define quantlib_analytic_gjrgarch_engine_hpp
26
31#include <complex>
32
33namespace QuantLib {
34
35 //! GJR-GARCH(1,1) engine
36 /*! References:
37
38 Jin-Chuan Duan, Genevieve Gauthier, Jean-Guy Simonato,
39 Caroline Sasseville, 2006. Approximating the GJR-GARCH
40 and EGARCH option pricing models analytically
41 Journal of Computational Finance, Volume 9, Number 3,
42 Spring 2006
43
44 \ingroup vanillaengines
45
46 \test the correctness of the returned value is tested by
47 reproducing results available in the Duan et al's
48 2006 paper.
49 */
50
52 : public GenericModelEngine<GJRGARCHModel,
53 VanillaOption::arguments,
54 VanillaOption::results> {
55 public:
56 AnalyticGJRGARCHEngine(const ext::shared_ptr<GJRGARCHModel>& model);
57 void calculate() const override;
58 // call back for extended stochastic volatility
59 // plus jump diffusion engines like bates model
60 private:
61// store parameters
62 mutable bool init_;
63 mutable Real h1_;
64 mutable Real b0_;
65 mutable Real b1_;
66 mutable Real b2_;
67 mutable Real b3_;
68 mutable Real la_;
69 mutable Real r_;
70 mutable Size T_;
71// intermediate constants determined by b1,b2,b3,la
72 mutable Real m1_;
73 mutable Real m2_;
74 mutable Real m3_;
75 mutable Real v1_;
76 mutable Real v2_;
77 mutable Real v3_;
78 mutable Real z1_;
79 mutable Real z2_;
80 mutable Real x1_;
81// statistical data for the GJR-GARCH process determined by
82// h1,b0,b1,b2,b3,r,T
83 mutable Real ex_; // mean
84 mutable Real sigma_; // variance
85 mutable Real k3_; // skewness
86 mutable Real k4_; // kurtosis
87 };
88
89}
90
91#endif
Base class for some pricing engine on a particular model.
Integral of a 1-dimensional function using the Gauss quadratures.
Generic option engine based on a model.
GJR-GARCH model for the stochastic volatility of an asset.
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
Vanilla option on a single asset.