Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
analyticdigitalamericanengine.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2022 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/*! \file qle/pricingengines/analyticdigitalamericanengine.hpp
20 \brief Wrapper of QuantLib analytic digital American option engine to allow for flipping back some of the additional
21 results in the case of FX instruments where the trade builder may have inverted the underlying pair
22*/
23
24#ifndef quantext_analytic_digital_american_engine_hpp
25#define quantext_analytic_digital_american_engine_hpp
26
27#include <ql/instruments/vanillaoption.hpp>
28#include <ql/pricingengines/vanilla/analyticdigitalamericanengine.hpp>
29#include <ql/processes/blackscholesprocess.hpp>
30
31namespace QuantExt {
32
33using namespace QuantLib;
34
35//! Analytic pricing engine for American vanilla options with digital payoff
36
37class AnalyticDigitalAmericanEngine : public QuantLib::AnalyticDigitalAmericanEngine {
38public:
39 AnalyticDigitalAmericanEngine(ext::shared_ptr<GeneralizedBlackScholesProcess> process,
40 const QuantLib::Date& payDate, const bool flipResults = false)
41 : QuantLib::AnalyticDigitalAmericanEngine(process), process_(std::move(process)), payDate_(payDate),
42 flipResults_(flipResults) {
43 registerWith(process_);
44 }
45 void calculate() const override;
46 virtual bool knock_in() const override { return true; }
47
48private:
49 ext::shared_ptr<GeneralizedBlackScholesProcess> process_;
50 QuantLib::Date payDate_;
52};
53
54//! Analytic pricing engine for American Knock-out options with digital payoff
55
57public:
58 AnalyticDigitalAmericanKOEngine(const ext::shared_ptr<GeneralizedBlackScholesProcess>& engine,
59 const QuantLib::Date& payDate, const bool flipResults = false)
60 : AnalyticDigitalAmericanEngine(engine, payDate, flipResults) {}
61 bool knock_in() const override { return false; }
62};
63
64} // namespace QuantExt
65
66#endif
Analytic pricing engine for American vanilla options with digital payoff.
AnalyticDigitalAmericanEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process, const QuantLib::Date &payDate, const bool flipResults=false)
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
Analytic pricing engine for American Knock-out options with digital payoff.
AnalyticDigitalAmericanKOEngine(const ext::shared_ptr< GeneralizedBlackScholesProcess > &engine, const QuantLib::Date &payDate, const bool flipResults=false)