Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
commodityspreadoption.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#pragma once
19
23
24namespace ore::data {
25
27public:
28
30 public:
31 ScheduleData schedule() const { return schedule_; }
32 BusinessDayConvention bdc() const { return bdc_; }
33 int lag() const { return lag_; }
34 Calendar calendar() const { return calendar_; }
35 //! \name Serialisation
36 //@{
37 void fromXML(XMLNode* node) override;
38 XMLNode* toXML(XMLDocument& doc) const override;
39 //@}
40 private:
42 BusinessDayConvention bdc_;
43 int lag_;
44 Calendar calendar_;
45 };
46
48 CommoditySpreadOptionData(const std::vector<ore::data::LegData>& legData, const ore::data::OptionData& optionData,
49 QuantLib::Real strike)
51 //! \name Serialisation
52 //@{
53 void fromXML(XMLNode* node) override;
54 XMLNode* toXML(XMLDocument& doc) const override;
55 //@}
56
57 const std::vector<ore::data::LegData>& legData() const { return legData_; }
58 const ore::data::OptionData& optionData() const { return optionData_; }
59 QuantLib::Real strike() const { return strike_; }
60 boost::optional<OptionStripData> optionStrip() { return optionStrip_; }
61
62private:
63 QuantLib::ext::shared_ptr<ore::data::LegData> createLegData() const { return QuantLib::ext::make_shared<ore::data::LegData>(); }
64
65 std::vector<ore::data::LegData> legData_;
67 QuantLib::Real strike_;
68
69 boost::optional<OptionStripData> optionStrip_;
70
71};
72
74public:
75 CommoditySpreadOption() : ore::data::Trade("CommoditySpreadOption") {}
77 : ore::data::Trade("CommoditySpreadOption"), csoData_(data) {}
78
79 //! Implement the build method
80 void build(const QuantLib::ext::shared_ptr<ore::data::EngineFactory>& engineFactory) override;
81
82 //! \name Serialisation
83 //@{
84 void fromXML(XMLNode* node) override;
85 XMLNode* toXML(XMLDocument& doc) const override;
86 //@}
87
88 //! \name Inspectors
89 //@{
90 std::vector<std::string> const& fxIndex() const { return fxIndex_; }
91 const ore::data::OptionData& option() const { return csoData_.optionData(); }
92 QuantLib::Real strike() const { return csoData_.strike(); }
93
94 //@}
95
96 //! Add underlying Commodity names
97 std::map<ore::data::AssetClass, std::set<std::string>>
98 underlyingIndices(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager = nullptr) const override;
99
100private:
102 std::vector<std::string> fxIndex_;
103};
104} // namespace ore::data
XMLNode * toXML(XMLDocument &doc) const override
const std::vector< ore::data::LegData > & legData() const
boost::optional< OptionStripData > optionStrip_
std::vector< ore::data::LegData > legData_
const ore::data::OptionData & optionData() const
XMLNode * toXML(XMLDocument &doc) const override
QuantLib::ext::shared_ptr< ore::data::LegData > createLegData() const
CommoditySpreadOptionData(const std::vector< ore::data::LegData > &legData, const ore::data::OptionData &optionData, QuantLib::Real strike)
boost::optional< OptionStripData > optionStrip()
CommoditySpreadOption(const CommoditySpreadOptionData &data)
const ore::data::OptionData & option() const
std::vector< std::string > const & fxIndex() const
Serializable object holding option data.
Definition: optiondata.hpp:42
Serializable schedule data.
Definition: schedule.hpp:202
Trade base class.
Definition: trade.hpp:55
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
leg data for commodity leg types
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
trade option data model and serialization
base trade data model and serialization