Coverage Report

Created: 2026-01-25 06:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/quantlib/ql/models/equity/batesmodel.hpp
Line
Count
Source
1
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*
4
 Copyright (C) 2005 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
 <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 batesmodel.hpp
21
    \brief extended versions of the Heston model
22
*/
23
24
#ifndef quantlib_bates_model_hpp
25
#define quantlib_bates_model_hpp
26
27
#include <ql/processes/batesprocess.hpp>
28
#include <ql/models/equity/hestonmodel.hpp>
29
30
namespace QuantLib {
31
32
    //! Bates stochastic-volatility model
33
    /*! extended versions of Heston model for the stochastic
34
        volatility of an asset including jumps.
35
36
        References:
37
        A. Sepp, Pricing European-Style Options under Jump Diffusion
38
        Processes with Stochastic Volatility: Applications of Fourier
39
        Transform (<http://math.ut.ee/~spartak/papers/stochjumpvols.pdf>)
40
41
        \test calibration is tested against known values.
42
    */
43
    class BatesModel : public HestonModel {
44
      public:
45
        explicit BatesModel(const ext::shared_ptr<BatesProcess> & process);
46
47
0
        Real nu()     const { return arguments_[5](0.0); }
48
0
        Real delta()  const { return arguments_[6](0.0); }
49
0
        Real lambda() const { return arguments_[7](0.0); }
50
51
      protected:
52
        void generateArguments() override;
53
    };
54
55
56
    class BatesDetJumpModel : public BatesModel {
57
      public:
58
        explicit BatesDetJumpModel(
59
            const ext::shared_ptr<BatesProcess> & process,
60
            Real kappaLambda = 1.0, Real thetaLambda = 0.1);
61
62
0
        Real kappaLambda() const { return arguments_[8](0.0); }
63
0
        Real thetaLambda() const { return arguments_[9](0.0); }
64
    };
65
66
67
    class BatesDoubleExpModel : public HestonModel {
68
      public:
69
        explicit BatesDoubleExpModel(
70
            const ext::shared_ptr<HestonProcess> & process,
71
            Real lambda = 0.1, Real nuUp = 0.1, Real nuDown = 0.1, Real p = 0.5);
72
73
0
        Real p()      const { return arguments_[5](0.0); }
74
0
        Real nuDown() const { return arguments_[6](0.0); }
75
0
        Real nuUp()   const { return arguments_[7](0.0); }
76
0
        Real lambda() const { return arguments_[8](0.0); }
77
    };
78
79
80
    class BatesDoubleExpDetJumpModel : public BatesDoubleExpModel {
81
      public:
82
        explicit BatesDoubleExpDetJumpModel(
83
            const ext::shared_ptr<HestonProcess> & process,
84
            Real lambda = 0.1, Real nuUp = 0.1,   Real nuDown = 0.1,
85
            Real p = 0.5, Real kappaLambda = 1.0, Real thetaLambda = 0.1);
86
87
0
        Real kappaLambda() const { return arguments_[9](0.0); }
88
0
        Real thetaLambda() const { return arguments_[10](0.0); }
89
    };
90
91
}
92
93
94
#endif
95