Coverage Report

Created: 2026-03-31 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/models/equity/gjrgarchmodel.hpp
Line
Count
Source
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
 <https://www.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 gjrgarchmodel.hpp
21
    \brief GJR-GARCH model for the stochastic volatility of an asset
22
*/
23
24
#ifndef quantlib_gjrgarch_model_hpp
25
#define quantlib_gjrgarch_model_hpp
26
27
#include <ql/models/model.hpp>
28
#include <ql/processes/gjrgarchprocess.hpp>
29
30
namespace QuantLib {
31
32
    //! GJR-GARCH model for the stochastic volatility of an asset
33
    /*! References:
34
35
        Glosten, L., Jagannathan, R., Runkle, D., 1993. 
36
    Relationship between the expected value and the volatility
37
    of the nominal excess return on stocks. Journal of Finance
38
    48, 1779-1801
39
40
        \test calibration is not implemented for GJR-GARCH
41
    */
42
    class GJRGARCHModel : public CalibratedModel {
43
      public:
44
        GJRGARCHModel(const ext::shared_ptr<GJRGARCHProcess>& process);
45
46
        // variance mean reversion level multiplied by
47
        // the proportion not accounted by alpha, beta and gamma
48
0
        Real omega() const { return arguments_[0](0.0); }
49
        // proportion attributed to the impact of all innovations
50
0
        Real alpha() const { return arguments_[1](0.0); }
51
        // proportion attributed to the impact of previous variance
52
0
        Real beta() const { return arguments_[2](0.0); }
53
        // proportion attributed to the impact of negative innovations
54
0
        Real gamma()   const { return arguments_[3](0.0); }
55
        // market price of risk
56
0
        Real lambda()   const { return arguments_[4](0.0); }
57
        // spot variance
58
0
        Real v0()    const { return arguments_[5](0.0); }
59
60
        // underlying process
61
0
        ext::shared_ptr<GJRGARCHProcess> process() const { return process_; }
62
63
        class VolatilityConstraint;
64
      protected:
65
        void generateArguments() override;
66
        ext::shared_ptr<GJRGARCHProcess> process_;
67
    };
68
}
69
70
71
#endif
72