Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
outperformanceoption.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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 ple/instruments/outperformanceoption.hpp
20 \brief outperformance option
21*/
22
23#ifndef quantext_outperformance_option_hpp
24#define quantext_outperformance_option_hpp
25
26#include <ql/option.hpp>
27#include <ql/event.hpp>
29
30
31namespace QuantLib {
32class Quote;
33class YieldTermStructure;
34} // namespace QuantLib
35
36namespace QuantExt {
37using namespace QuantLib;
38
39//! Outperformance option
40
41class OutperformanceOption : public QuantLib::Instrument {
42public:
43 class arguments;
44 class results;
45 class engine;
46 OutperformanceOption(const QuantLib::ext::shared_ptr<Exercise>& exercise, const Option::Type optionType,
47 const Real strikeReturn, const Real initialValue1, const Real initialValue2, const Real notional,
48 const Real knockInPrice = Null<Real>(), const Real knockOutPrice = Null<Real>(), QuantLib::ext::shared_ptr<QuantExt::FxIndex> fxIndex1 = nullptr,
49 QuantLib::ext::shared_ptr<QuantExt::FxIndex> fxIndex2 = nullptr);
50
51 //! \name Instrument interface
52 //@{
53 bool isExpired() const override;
54 void setupArguments(PricingEngine::arguments*) const override;
55 //@}
56
57 QuantLib::ext::shared_ptr<Exercise> exercise() const { return exercise_; }
58 Option::Type optionType() const { return optionType_; }
59 Real strikeReturn() const { return strikeReturn_; }
60 Real initialValue1() const { return initialValue1_; }
61 Real initialValue2() const { return initialValue2_; }
62 Real notional() const { return notional_; }
63 Real knockInPrice() const { return knockInPrice_; }
64 Real knockOutPrice() const { return knockOutPrice_; }
65 QuantLib::ext::shared_ptr<QuantExt::FxIndex> fxIndex1() const { return fxIndex1_; }
66 QuantLib::ext::shared_ptr<QuantExt::FxIndex> fxIndex2() const { return fxIndex2_; }
67private:
68 void setupExpired() const override;
69 void fetchResults(const PricingEngine::results*) const override;
70
71 QuantLib::ext::shared_ptr<Exercise> exercise_;
72 Option::Type optionType_;
79 QuantLib::ext::shared_ptr<QuantExt::FxIndex> fxIndex1_;
80 QuantLib::ext::shared_ptr<QuantExt::FxIndex> fxIndex2_;
81};
82
83//! %Arguments for Outperformance option calculation
85public:
86 QuantLib::ext::shared_ptr<Exercise> exercise;
87 Option::Type optionType;
94 QuantLib::ext::shared_ptr<QuantExt::FxIndex> fxIndex1;
95 QuantLib::ext::shared_ptr<QuantExt::FxIndex> fxIndex2;
96 void validate() const override;
97};
98
99//! %Results from Outperformance option calculation
101public:
103 void reset() override {
104 standardDeviation = Null<Real>();
105 Instrument::results::reset();
106 }
107};
108
109//! base class for outperformance option engines
110class OutperformanceOption::engine : public GenericEngine<OutperformanceOption::arguments, OutperformanceOption::results> {};
111} // namespace QuantExt
112
113#endif
Arguments for Outperformance option calculation
QuantLib::ext::shared_ptr< QuantExt::FxIndex > fxIndex2
QuantLib::ext::shared_ptr< QuantExt::FxIndex > fxIndex1
QuantLib::ext::shared_ptr< Exercise > exercise
base class for outperformance option engines
Results from Outperformance option calculation
void setupArguments(PricingEngine::arguments *) const override
QuantLib::ext::shared_ptr< QuantExt::FxIndex > fxIndex1() const
QuantLib::ext::shared_ptr< Exercise > exercise_
QuantLib::ext::shared_ptr< QuantExt::FxIndex > fxIndex2() const
QuantLib::ext::shared_ptr< QuantExt::FxIndex > fxIndex1_
QuantLib::ext::shared_ptr< QuantExt::FxIndex > fxIndex2_
QuantLib::ext::shared_ptr< Exercise > exercise() const
void fetchResults(const PricingEngine::results *) const override
FX index class.