QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
hestonexpansionengine.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) 2014 Fabien Le Floc'h
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 hestonexpansionengine.hpp
21 \brief analytic Heston expansion engine
22*/
23
24#ifndef quantlib_heston_expansion_engine_hpp
25#define quantlib_heston_expansion_engine_hpp
26
30
31namespace QuantLib {
32
33 //! Heston-model engine for European options based on analytic expansions
34 /*! References:
35
36 M Forde, A Jacquier, R Lee, The small-time smile and term
37 structure of implied volatility under the Heston model
38 SIAM Journal on Financial Mathematics, 2012 - SIAM
39
40 M Lorig, S Pagliarani, A Pascucci, Explicit implied vols for
41 multifactor local-stochastic vol models
42 arXiv preprint arXiv:1306.5447v3, 2014 - arxiv.org
43
44 \ingroup vanillaengines
45 */
47 : public GenericModelEngine<HestonModel,
48 VanillaOption::arguments,
49 VanillaOption::results> {
50 public:
52
53 HestonExpansionEngine(const ext::shared_ptr<HestonModel>& model,
55
56 void calculate() const override;
57
58 private:
60 };
61
62 /*! Interface to represent some Heston expansion formula.
63 During calibration, it would typically be initialized once per
64 implied volatility surface slice, then calls for each surface
65 strike to impliedVolatility(strike, forward) would be
66 performed.
67 */
69 public:
70 virtual ~HestonExpansion() = default;
71 virtual Real impliedVolatility(Real strike, Real forward) const = 0;
72 };
73
74 /*! Lorig Pagliarani Pascucci expansion of order-2 for the Heston model.
75 During calibration, it can be initialized once per expiry, and
76 called many times with different strikes. The formula is also
77 available in the Mathematica notebook from the authors at
78 http://explicitsolutions.wordpress.com/
79 */
81 public:
83 Real impliedVolatility(Real strike, Real forward) const override;
84
85 private:
89 Real delta, Real y, Real rho) const;
91 Real delta, Real y, Real rho) const;
93 Real delta, Real y, Real rho) const;
94 };
95
96 /*! Lorig Pagliarani Pascucci expansion of order-3 for the Heston model.
97 During calibration, it can be initialized once per expiry, and
98 called many times with different strikes. The formula is also
99 available in the Mathematica notebook from the authors at
100 http://explicitsolutions.wordpress.com/
101 */
103 public:
105 Real impliedVolatility(Real strike, Real forward) const override;
106
107 private:
111 Real delta, Real y, Real rho) const;
113 Real delta, Real y, Real rho) const;
115 Real delta, Real y, Real rho) const;
117 Real delta, Real y, Real rho) const;
118 };
119
120 /*! Small-time expansion from
121 "The small-time smile and term structure of implied volatility
122 under the Heston model" M Forde, A Jacquier, R Lee - SIAM
123 Journal on Financial Mathematics, 2012 - SIAM
124 */
126 public:
128 Real impliedVolatility(Real strike, Real forward) const override;
129
130 private:
132 };
133
134}
135
136
137#endif
Real impliedVolatility(Real strike, Real forward) const override
Base class for some pricing engine on a particular model.
Heston-model engine for European options based on analytic expansions.
const HestonExpansionFormula formula_
virtual Real impliedVolatility(Real strike, Real forward) const =0
virtual ~HestonExpansion()=default
Real z0(Real t, Real kappa, Real theta, Real delta, Real y, Real rho) const
Real impliedVolatility(Real strike, Real forward) const override
Real z2(Real t, Real kappa, Real theta, Real delta, Real y, Real rho) const
Real z1(Real t, Real kappa, Real theta, Real delta, Real y, Real rho) const
Real z3(Real t, Real kappa, Real theta, Real delta, Real y, Real rho) const
Real z0(Real t, Real kappa, Real theta, Real delta, Real y, Real rho) const
Real impliedVolatility(Real strike, Real forward) const override
Real z2(Real t, Real kappa, Real theta, Real delta, Real y, Real rho) const
Real z1(Real t, Real kappa, Real theta, Real delta, Real y, Real rho) const
const DefaultType & t
Generic option engine based on a model.
QL_REAL Real
real number
Definition: types.hpp:50
Heston model for the stochastic volatility of an asset.
Real kappa
Real theta
Real v0
Real rho
Real sigma
Definition: any.hpp:35
Vanilla option on a single asset.