Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
baroneadesiwhaleyengine.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18/*
19
20 Copyright (C) 2003, 2004 Ferdinando Ametrano
21 Copyright (C) 2007 StatPro Italia srl
22
23 This file is part of QuantLib, a free-software/open-source library
24 for financial quantitative analysts and developers - http://quantlib.org/
25
26 QuantLib is free software: you can redistribute it and/or modify it
27 under the terms of the QuantLib license. You should have received a
28 copy of the license along with this program; if not, please email
29 <quantlib-dev@lists.sf.net>. The license is also available online at
30 <http://quantlib.org/license.shtml>.
31
32 This program is distributed in the hope that it will be useful, but WITHOUT
33 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
34 FOR A PARTICULAR PURPOSE. See the license for more details.
35*/
36
37/*! \file baroneadesiwhaleyengine.hpp
38 \brief Barone-Adesi and Whaley approximation engine
39*/
40
41#ifndef quantext_barone_adesi_whaley_engine_hpp
42#define quantext_barone_adesi_whaley_engine_hpp
43
44#include <ql/instruments/vanillaoption.hpp>
45#include <ql/processes/blackscholesprocess.hpp>
46
47namespace QuantExt {
48
49/*! Barone-Adesi and Whaley pricing engine for American options (1987)
50 This QuantExt class is a copy of the class with the same name in
51 QuantLib v1.14 with the following change
52 - Added handling for put option where early exercise is never optimal */
53/*! \ingroup vanillaengines
54
55 \test the correctness of the returned value is tested by
56 reproducing results available in literature.
57*/
59public:
60 BaroneAdesiWhaleyApproximationEngine(const QuantLib::ext::shared_ptr<QuantLib::GeneralizedBlackScholesProcess>&);
61 static QuantLib::Real criticalPrice(const QuantLib::ext::shared_ptr<QuantLib::StrikedTypePayoff>& payoff,
62 QuantLib::DiscountFactor riskFreeDiscount,
63 QuantLib::DiscountFactor dividendDiscount, QuantLib::Real variance,
64 QuantLib::Real tolerance = 1e-6);
65 void calculate() const override;
66
67private:
68 QuantLib::ext::shared_ptr<QuantLib::GeneralizedBlackScholesProcess> process_;
69};
70
71} // namespace QuantExt
72
73#endif
QuantLib::ext::shared_ptr< QuantLib::GeneralizedBlackScholesProcess > process_
static QuantLib::Real criticalPrice(const QuantLib::ext::shared_ptr< QuantLib::StrikedTypePayoff > &payoff, QuantLib::DiscountFactor riskFreeDiscount, QuantLib::DiscountFactor dividendDiscount, QuantLib::Real variance, QuantLib::Real tolerance=1e-6)
RandomVariable variance(const RandomVariable &r)