Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cashsettledeuropeanoption.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 qle/instruments/cashsettledeuropeanoption.hpp
20 \brief cash settled european vanilla option.
21 \ingroup instruments
22*/
23
24#ifndef quantext_cash_settled_european_option_hpp
25#define quantext_cash_settled_european_option_hpp
26
27#include <ql/index.hpp>
28#include <ql/instruments/vanillaoption.hpp>
29
30namespace QuantExt {
31
32/*! Vanilla cash settled European options allowing for deferred payment and automatic exercise.
33
34 \ingroup instruments
35*/
36class CashSettledEuropeanOption : public QuantLib::VanillaOption {
37public:
38 class arguments;
39 class engine;
40
41 //! Constructor for cash settled vanilla European option.
42 CashSettledEuropeanOption(QuantLib::Option::Type type, QuantLib::Real strike, const QuantLib::Date& expiryDate,
43 const QuantLib::Date& paymentDate, bool automaticExercise,
44 const QuantLib::ext::shared_ptr<QuantLib::Index>& underlying = nullptr, bool exercised = false,
45 QuantLib::Real priceAtExercise = QuantLib::Null<QuantLib::Real>());
46
47 //! Constructor for cash settled vanilla European option.
48 CashSettledEuropeanOption(QuantLib::Option::Type type, QuantLib::Real strike, const QuantLib::Date& expiryDate,
49 QuantLib::Natural paymentLag, const QuantLib::Calendar& paymentCalendar,
50 QuantLib::BusinessDayConvention paymentConvention, bool automaticExercise,
51 const QuantLib::ext::shared_ptr<QuantLib::Index>& underlying = nullptr, bool exercised = false,
52 QuantLib::Real priceAtExercise = QuantLib::Null<QuantLib::Real>());
53
54 //! Constructor for cash settled vanilla European option with digital payoff.
55 CashSettledEuropeanOption(QuantLib::Option::Type type, QuantLib::Real strike, QuantLib::Real cashPayoff,
56 const QuantLib::Date& expiryDate, const QuantLib::Date& paymentDate,
57 bool automaticExercise, const QuantLib::ext::shared_ptr<QuantLib::Index>& underlying = nullptr,
58 bool exercised = false,
59 QuantLib::Real priceAtExercise = QuantLib::Null<QuantLib::Real>());
60
61 //! Constructor for cash settled vanilla European option with digital payoff.
62 CashSettledEuropeanOption(QuantLib::Option::Type type, QuantLib::Real strike, QuantLib::Real cashPayoff,
63 const QuantLib::Date& expiryDate, QuantLib::Natural paymentLag,
64 const QuantLib::Calendar& paymentCalendar,
65 QuantLib::BusinessDayConvention paymentConvention, bool automaticExercise,
66 const QuantLib::ext::shared_ptr<QuantLib::Index>& underlying = nullptr, bool exercised = false,
67 QuantLib::Real priceAtExercise = QuantLib::Null<QuantLib::Real>());
68
69 //! \name Instrument interface
70 //@{
71 //! Account for cash settled European options not being expired until payment is made.
72 bool isExpired() const override;
73
74 //! Set up the extra arguments.
75 void setupArguments(QuantLib::PricingEngine::arguments* args) const override;
76 //@}
77
78 //! Mark option as manually exercised at the given \p priceAtExercise.
79 void exercise(QuantLib::Real priceAtExercise);
80
81 //! \name Inspectors
82 //@{
83 const QuantLib::Date& paymentDate() const;
84 bool automaticExercise() const;
85 const QuantLib::ext::shared_ptr<QuantLib::Index>& underlying() const;
86 bool exercised() const;
87 QuantLib::Real priceAtExercise() const;
88 //@}
89
90private:
91 QuantLib::Date paymentDate_;
93 QuantLib::ext::shared_ptr<QuantLib::Index> underlying_;
95 QuantLib::Real priceAtExercise_;
96
97 //! Shared initialisation
98 void init(bool exercised, QuantLib::Real priceAtExercise);
99};
100
102public:
104 void validate() const override;
105
106 QuantLib::Date paymentDate;
108 QuantLib::ext::shared_ptr<QuantLib::Index> underlying;
110 QuantLib::Real priceAtExercise;
111};
112
113//! Engine
115 : public QuantLib::GenericEngine<CashSettledEuropeanOption::arguments, CashSettledEuropeanOption::results> {};
116
117} // namespace QuantExt
118
119#endif
QuantLib::ext::shared_ptr< QuantLib::Index > underlying
void setupArguments(QuantLib::PricingEngine::arguments *args) const override
Set up the extra arguments.
bool isExpired() const override
Account for cash settled European options not being expired until payment is made.
CashSettledEuropeanOption(QuantLib::Option::Type type, QuantLib::Real strike, const QuantLib::Date &expiryDate, QuantLib::Natural paymentLag, const QuantLib::Calendar &paymentCalendar, QuantLib::BusinessDayConvention paymentConvention, bool automaticExercise, const QuantLib::ext::shared_ptr< QuantLib::Index > &underlying=nullptr, bool exercised=false, QuantLib::Real priceAtExercise=QuantLib::Null< QuantLib::Real >())
Constructor for cash settled vanilla European option.
const QuantLib::ext::shared_ptr< QuantLib::Index > & underlying() const
const QuantLib::Date & paymentDate() const
CashSettledEuropeanOption(QuantLib::Option::Type type, QuantLib::Real strike, QuantLib::Real cashPayoff, const QuantLib::Date &expiryDate, const QuantLib::Date &paymentDate, bool automaticExercise, const QuantLib::ext::shared_ptr< QuantLib::Index > &underlying=nullptr, bool exercised=false, QuantLib::Real priceAtExercise=QuantLib::Null< QuantLib::Real >())
Constructor for cash settled vanilla European option with digital payoff.
CashSettledEuropeanOption(QuantLib::Option::Type type, QuantLib::Real strike, const QuantLib::Date &expiryDate, const QuantLib::Date &paymentDate, bool automaticExercise, const QuantLib::ext::shared_ptr< QuantLib::Index > &underlying=nullptr, bool exercised=false, QuantLib::Real priceAtExercise=QuantLib::Null< QuantLib::Real >())
Constructor for cash settled vanilla European option.
void init(bool exercised, QuantLib::Real priceAtExercise)
Shared initialisation.
CashSettledEuropeanOption(QuantLib::Option::Type type, QuantLib::Real strike, QuantLib::Real cashPayoff, const QuantLib::Date &expiryDate, QuantLib::Natural paymentLag, const QuantLib::Calendar &paymentCalendar, QuantLib::BusinessDayConvention paymentConvention, bool automaticExercise, const QuantLib::ext::shared_ptr< QuantLib::Index > &underlying=nullptr, bool exercised=false, QuantLib::Real priceAtExercise=QuantLib::Null< QuantLib::Real >())
Constructor for cash settled vanilla European option with digital payoff.
QuantLib::ext::shared_ptr< QuantLib::Index > underlying_
void exercise(QuantLib::Real priceAtExercise)
Mark option as manually exercised at the given priceAtExercise.