QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
qdfpamericanengine.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2022 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 <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
23#ifndef quantlib_qd_fp_american_engine_hpp
24#define quantlib_qd_fp_american_engine_hpp
25
26#include <ql/pricingengines/vanilla/qdplusamericanengine.hpp>
27
28namespace QuantLib {
29
30 class Integrator;
31
34 public:
38
39 virtual ext::shared_ptr<Integrator> getFixedPointIntegrator() const = 0;
40 virtual ext::shared_ptr<Integrator> getExerciseBoundaryToPriceIntegrator() const = 0;
41
42 virtual ~QdFpIterationScheme() = default;
43 };
44
46
54 public:
56
60
61 ext::shared_ptr<Integrator> getFixedPointIntegrator() const override;
62 ext::shared_ptr<Integrator> getExerciseBoundaryToPriceIntegrator() const override;
63
64 private:
65 const Size m_, n_;
66 const ext::shared_ptr<Integrator> fpIntegrator_;
67 const ext::shared_ptr<Integrator> exerciseBoundaryIntegrator_;
68 };
69
71
79 public:
81
82 ext::shared_ptr<Integrator> getExerciseBoundaryToPriceIntegrator() const override;
83
84 private:
85 const Real eps_;
86 };
87
89
95 public:
97
101
102 ext::shared_ptr<Integrator> getFixedPointIntegrator() const override;
103 ext::shared_ptr<Integrator> getExerciseBoundaryToPriceIntegrator() const override;
104 private:
105 const Size m_, n_;
106 const ext::shared_ptr<Integrator> integrator_;
107 };
108
109
111
122 public:
124
125 explicit QdFpAmericanEngine(
126 ext::shared_ptr<GeneralizedBlackScholesProcess> bsProcess,
127 ext::shared_ptr<QdFpIterationScheme> iterationScheme = accurateScheme(),
128 FixedPointEquation fpEquation = Auto);
129
130 static ext::shared_ptr<QdFpIterationScheme> fastScheme();
131 static ext::shared_ptr<QdFpIterationScheme> accurateScheme();
132 static ext::shared_ptr<QdFpIterationScheme> highPrecisionScheme();
133
134 protected:
136 Real S, Real K, Rate r, Rate q, Volatility vol, Time T) const override;
137
138 private:
139 const ext::shared_ptr<QdFpIterationScheme> iterationScheme_;
141 };
142
143}
144
145#endif
High performance/precision American engine based on fixed point iteration for the exercise boundary.
static ext::shared_ptr< QdFpIterationScheme > highPrecisionScheme()
static ext::shared_ptr< QdFpIterationScheme > fastScheme()
const FixedPointEquation fpEquation_
const ext::shared_ptr< QdFpIterationScheme > iterationScheme_
static ext::shared_ptr< QdFpIterationScheme > accurateScheme()
Real calculatePut(Real S, Real K, Rate r, Rate q, Volatility vol, Time T) const override
Iteration scheme for fixed-point QD American engine.
virtual ~QdFpIterationScheme()=default
virtual ext::shared_ptr< Integrator > getFixedPointIntegrator() const =0
virtual Size getNumberOfNaiveFixedPointSteps() const =0
virtual Size getNumberOfJacobiNewtonFixedPointSteps() const =0
virtual Size getNumberOfChebyshevInterpolationNodes() const =0
virtual ext::shared_ptr< Integrator > getExerciseBoundaryToPriceIntegrator() const =0
Gauss-Legendre (l,m,n)-p Scheme.
Size getNumberOfChebyshevInterpolationNodes() const override
ext::shared_ptr< Integrator > getFixedPointIntegrator() const override
Size getNumberOfNaiveFixedPointSteps() const override
const ext::shared_ptr< Integrator > exerciseBoundaryIntegrator_
ext::shared_ptr< Integrator > getExerciseBoundaryToPriceIntegrator() const override
Size getNumberOfJacobiNewtonFixedPointSteps() const override
const ext::shared_ptr< Integrator > fpIntegrator_
Legendre-Tanh-Sinh (l,m,n)-eps Scheme.
ext::shared_ptr< Integrator > getExerciseBoundaryToPriceIntegrator() const override
Size getNumberOfChebyshevInterpolationNodes() const override
ext::shared_ptr< Integrator > getFixedPointIntegrator() const override
Size getNumberOfNaiveFixedPointSteps() const override
ext::shared_ptr< Integrator > getExerciseBoundaryToPriceIntegrator() const override
Size getNumberOfJacobiNewtonFixedPointSteps() const override
const ext::shared_ptr< Integrator > integrator_
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Real Volatility
volatility
Definition: types.hpp:78
Real Rate
interest rates
Definition: types.hpp:70
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35