Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
genericbarrieroption.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 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 ored/portfolio/genericbarrieroption.hpp
20 \brief generic barrier option wrapper for scripted trade
21 \ingroup portfolio
22*/
23
24#pragma once
25
27
32
33namespace ore {
34namespace data {
35
37public:
38 explicit GenericBarrierOption(const std::string& tradeType = "GenericBarrierOption") : ScriptedTrade(tradeType) {}
39 GenericBarrierOption(std::vector<QuantLib::ext::shared_ptr<Underlying>> underlyings, const OptionData& optionData,
40 const std::vector<BarrierData>& barriers, const ScheduleData& barrierMonitoringDates,
41 const std::vector<BarrierData>& transatlanticBarrier, const std::string& payCurrency,
42 const std::string& settlementDate, const std::string& quantity, const std::string& strike,
43 const std::string& amount, const std::string& kikoType)
44 : underlyings_(underlyings), optionData_(optionData), barriers_(barriers),
45 barrierMonitoringDates_(barrierMonitoringDates), transatlanticBarrier_(transatlanticBarrier),
46 payCurrency_(payCurrency), settlementDate_(settlementDate), quantity_(quantity), strike_(strike),
47 amount_(amount), kikoType_(kikoType) {
49 }
50
51 GenericBarrierOption(QuantLib::ext::shared_ptr<Underlying>& underlying, const OptionData& optionData,
52 const std::vector<BarrierData>& barriers, const ScheduleData& barrierMonitoringDates,
53 const BarrierData& transatlanticBarrier, const std::string& payCurrency,
54 const std::string& settlementDate, const std::string& quantity, const std::string& strike,
55 const std::string& amount, const std::string& kikoType)
56 : optionData_(optionData), barriers_(barriers),
57 barrierMonitoringDates_(barrierMonitoringDates),
58 payCurrency_(payCurrency), settlementDate_(settlementDate), quantity_(quantity), strike_(strike),
59 amount_(amount), kikoType_(kikoType) {
60 underlyings_.push_back(underlying);
61 transatlanticBarrier_.push_back(transatlanticBarrier);
63 }
64 void build(const QuantLib::ext::shared_ptr<EngineFactory>&) override;
65 void fromXML(XMLNode* node) override;
66 XMLNode* toXML(XMLDocument& doc) const override;
67
68 //! \name Inspectors
69 //@{
70 std::set<std::string> names() const {
71 std::set<std::string> names;
72 for (const auto& u : underlyings_)
73 names.insert(u->name());
74 return names;
75 }
76 //@}
77
78private:
79 void initIndices();
80 QuantLib::Calendar getUnderlyingCalendar(const QuantLib::ext::shared_ptr<EngineFactory>& factory) const;
81 std::vector<QuantLib::ext::shared_ptr<ore::data::Underlying>> underlyings_;
83 std::vector<BarrierData> barriers_;
85 std::vector<BarrierData> transatlanticBarrier_;
89};
90
92public:
93 EquityGenericBarrierOption() : GenericBarrierOption("EquityGenericBarrierOption") {}
94
95 std::map<ore::data::AssetClass, std::set<std::string>>
96 underlyingIndices(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager) const override {
97 return {{ore::data::AssetClass::EQ, names()}};
98 }
99};
100
102public:
103 FxGenericBarrierOption() : GenericBarrierOption("FxGenericBarrierOption") {}
104};
105
107public:
108 CommodityGenericBarrierOption() : GenericBarrierOption("CommodityGenericBarrierOption") {}
109};
110
111} // namespace data
112} // namespace ore
Serializable obejct holding barrier data.
Definition: barrierdata.hpp:34
std::map< ore::data::AssetClass, std::set< std::string > > underlyingIndices(const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager) const override
GenericBarrierOption(QuantLib::ext::shared_ptr< Underlying > &underlying, const OptionData &optionData, const std::vector< BarrierData > &barriers, const ScheduleData &barrierMonitoringDates, const BarrierData &transatlanticBarrier, const std::string &payCurrency, const std::string &settlementDate, const std::string &quantity, const std::string &strike, const std::string &amount, const std::string &kikoType)
std::vector< BarrierData > transatlanticBarrier_
std::set< std::string > names() const
std::vector< QuantLib::ext::shared_ptr< ore::data::Underlying > > underlyings_
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
GenericBarrierOption(std::vector< QuantLib::ext::shared_ptr< Underlying > > underlyings, const OptionData &optionData, const std::vector< BarrierData > &barriers, const ScheduleData &barrierMonitoringDates, const std::vector< BarrierData > &transatlanticBarrier, const std::string &payCurrency, const std::string &settlementDate, const std::string &quantity, const std::string &strike, const std::string &amount, const std::string &kikoType)
std::vector< BarrierData > barriers_
GenericBarrierOption(const std::string &tradeType="GenericBarrierOption")
QuantLib::Calendar getUnderlyingCalendar(const QuantLib::ext::shared_ptr< EngineFactory > &factory) const
void build(const QuantLib::ext::shared_ptr< EngineFactory > &) override
Serializable object holding option data.
Definition: optiondata.hpp:42
Serializable schedule data.
Definition: schedule.hpp:202
const string & tradeType() const
Definition: trade.hpp:133
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
trade option data model and serialization
scripted trade data model
base trade data model and serialization
underlying data model