Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cliquetoption.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 ORE is free software: you can redistribute it and/or modify it
8 under the terms of the Modified BSD License. You should have received a
9 copy of the license along with this program.
10
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 ored/portfolio/cliquetoption.hpp
20 \brief Equity Cliquet Option
21 \ingroup portfolio
22*/
23
24#pragma once
25
28
29namespace ore {
30namespace data {
31
32//! Serializable Equity Cliquet Option
33/*!
34 \ingroup tradedata
35*/
37public:
38 //! Default constructor
39 CliquetOption(const std::string& tradeType) : ore::data::Trade(tradeType) {}
40 //! Constructor
41 CliquetOption(const std::string& tradeType, ore::data::Envelope& env,
42 const QuantLib::ext::shared_ptr<ore::data::Underlying>& underlying, std::string currency,
43 QuantLib::Real notional, std::string longShort, std::string callPut,
44 ore::data::ScheduleData scheduleData, QuantLib::Real moneyness = 1.0,
45 QuantLib::Real localCap = QuantLib::Null<QuantLib::Real>(),
46 QuantLib::Real localFloor = QuantLib::Null<QuantLib::Real>(),
47 QuantLib::Real globalCap = QuantLib::Null<QuantLib::Real>(),
48 QuantLib::Real globalFloor = QuantLib::Null<QuantLib::Real>(), QuantLib::Size settlementDays = 0,
49 QuantLib::Real premium = 0.0, std::string premiumCcy = "", std::string premiumPayDate = "")
50 : ore::data::Trade(tradeType, env), underlying_(underlying), currency_(currency), longShort_(longShort),
51 callPut_(callPut), scheduleData_(scheduleData), moneyness_(moneyness), localCap_(localCap),
54 notional_ = notional;
55 }
56
57 //! Build QuantLib/QuantExt instrument, link pricing engine
58 void build(const QuantLib::ext::shared_ptr<ore::data::EngineFactory>&) override;
59
60 //! \name Inspectors
61 //@{
62 const std::string& name() const { return underlying_->name(); }
63 const QuantLib::ext::shared_ptr<ore::data::Underlying>& underlying() const { return underlying_; }
64 const std::string& currency() const { return currency_; }
65 const std::string& longShort() const { return longShort_; }
66 const std::string& callPut() const { return callPut_; }
68 const QuantLib::Real& moneyness() const { return moneyness_; }
69 const QuantLib::Real& localCap() const { return localCap_; }
70 const QuantLib::Real& localFloor() const { return localFloor_; }
71 const QuantLib::Real& globalCap() const { return globalCap_; }
72 const QuantLib::Real& globalFloor() const { return globalFloor_; }
73 QuantLib::Size settlementDays() const { return settlementDays_; }
74 QuantLib::Real premium() const { return premium_; }
75 const std::string& premiumCcy() const { return premiumCcy_; }
76 const std::string& premiumPayDate() const { return premiumPayDate_; }
77 //@}
78
79 //! \name Serialisation
80 //@{
81 virtual void fromXML(ore::data::XMLNode* node) override;
82 virtual ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
83 //@}
84
85private:
86 QuantLib::ext::shared_ptr<ore::data::Underlying> underlying_;
87 std::string currency_;
88 QuantLib::Real cliquetNotional_;
89 std::set<QuantLib::Date> valuationDates_;
90 std::string longShort_; // long or short
91 std::string callPut_; // call or put
93 QuantLib::Real moneyness_; // moneyness value
94 QuantLib::Real localCap_;
95 QuantLib::Real localFloor_;
96 QuantLib::Real globalCap_;
97 QuantLib::Real globalFloor_;
98 QuantLib::Size settlementDays_;
99 QuantLib::Real premium_;
100 std::string premiumCcy_;
101 std::string premiumPayDate_;
102};
103
105public:
106 EquityCliquetOption() : CliquetOption("EquityCliquetOption") {}
107 EquityCliquetOption(const std::string& tradeType, ore::data::Envelope& env,
108 const QuantLib::ext::shared_ptr<ore::data::Underlying>& underlying, std::string currency,
109 QuantLib::Real notional, std::string longShort, std::string callPut,
110 ore::data::ScheduleData scheduleData, QuantLib::Real moneyness = 1.0,
111 QuantLib::Real localCap = QuantLib::Null<QuantLib::Real>(),
112 QuantLib::Real localFloor = QuantLib::Null<QuantLib::Real>(),
113 QuantLib::Real globalCap = QuantLib::Null<QuantLib::Real>(),
114 QuantLib::Real globalFloor = QuantLib::Null<QuantLib::Real>(),
115 QuantLib::Size settlementDays = 0, QuantLib::Real premium = 0.0, std::string premiumCcy = "",
116 std::string premiumPayDate = "")
117 : CliquetOption(tradeType, env, underlying, currency, notional, longShort, callPut, scheduleData, moneyness,
118 localCap, localFloor, globalCap, globalFloor, settlementDays, premium, premiumCcy,
119 premiumPayDate) {}
120
121 //! Add underlying Equity names
122 std::map<ore::data::AssetClass, std::set<std::string>>
123 underlyingIndices(const QuantLib::ext::shared_ptr<ore::data::ReferenceDataManager>& referenceDataManager) const override {
124 return {{ore::data::AssetClass::EQ, std::set<std::string>({name()})}};
125 };
126};
127
128} // namespace data
129} // namespace ore
const Position::Type longShort_
QuantLib::ext::shared_ptr< ore::data::Underlying > underlying_
QuantLib::Size settlementDays() const
const QuantLib::Real & moneyness() const
const ore::data::ScheduleData & scheduleData() const
const std::string & currency() const
const std::string & name() const
QuantLib::Real globalFloor_
const std::string & callPut() const
ore::data::ScheduleData scheduleData_
CliquetOption(const std::string &tradeType)
Default constructor.
const QuantLib::Real & globalFloor() const
QuantLib::Real premium() const
const QuantLib::ext::shared_ptr< ore::data::Underlying > & underlying() const
QuantLib::Size settlementDays_
QuantLib::Real localFloor_
QuantLib::Real cliquetNotional_
const std::string & premiumCcy() const
CliquetOption(const std::string &tradeType, ore::data::Envelope &env, const QuantLib::ext::shared_ptr< ore::data::Underlying > &underlying, std::string currency, QuantLib::Real notional, std::string longShort, std::string callPut, ore::data::ScheduleData scheduleData, QuantLib::Real moneyness=1.0, QuantLib::Real localCap=QuantLib::Null< QuantLib::Real >(), QuantLib::Real localFloor=QuantLib::Null< QuantLib::Real >(), QuantLib::Real globalCap=QuantLib::Null< QuantLib::Real >(), QuantLib::Real globalFloor=QuantLib::Null< QuantLib::Real >(), QuantLib::Size settlementDays=0, QuantLib::Real premium=0.0, std::string premiumCcy="", std::string premiumPayDate="")
Constructor.
const QuantLib::Real & localFloor() const
const std::string & premiumPayDate() const
const std::string & longShort() const
std::set< QuantLib::Date > valuationDates_
const QuantLib::Real & globalCap() const
const QuantLib::Real & localCap() const
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
std::map< ore::data::AssetClass, std::set< std::string > > underlyingIndices(const QuantLib::ext::shared_ptr< ore::data::ReferenceDataManager > &referenceDataManager) const override
Add underlying Equity names.
EquityCliquetOption(const std::string &tradeType, ore::data::Envelope &env, const QuantLib::ext::shared_ptr< ore::data::Underlying > &underlying, std::string currency, QuantLib::Real notional, std::string longShort, std::string callPut, ore::data::ScheduleData scheduleData, QuantLib::Real moneyness=1.0, QuantLib::Real localCap=QuantLib::Null< QuantLib::Real >(), QuantLib::Real localFloor=QuantLib::Null< QuantLib::Real >(), QuantLib::Real globalCap=QuantLib::Null< QuantLib::Real >(), QuantLib::Real globalFloor=QuantLib::Null< QuantLib::Real >(), QuantLib::Size settlementDays=0, QuantLib::Real premium=0.0, std::string premiumCcy="", std::string premiumPayDate="")
Serializable schedule data.
Definition: schedule.hpp:202
Trade base class.
Definition: trade.hpp:55
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
string name
base trade data model and serialization
underlying data model