Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
commoditydigitalapo.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2023 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/commodityapo.hpp
20 \brief Commodity Average Price Option data model and serialization
21 \ingroup tradedata
22*/
23
24#pragma once
25
31
32namespace ore {
33namespace data {
34
35/*! Serializable Commodity Average Price Option
36 \ingroup tradedata
37*/
39public:
40 CommodityDigitalAveragePriceOption() : ore::data::Trade("CommodityDigitalAveragePriceOption") {}
41
44 QuantLib::Real strike, QuantLib::Real digitalCashPayoff, const std::string& currency, const std::string& name,
46 const std::string& startDate, const std::string& endDate, const std::string& paymentCalendar,
47 const std::string& paymentLag, const std::string& paymentConvention, const std::string& pricingCalendar,
48 const std::string& paymentDate = "", QuantLib::Real gearing = 1.0, QuantLib::Spread spread = 0.0,
50 QuantExt::CommodityQuantityFrequency::PerCalculationPeriod,
52 QuantLib::Natural futureMonthOffset = 0, QuantLib::Natural deliveryRollDays = 0, bool includePeriodEnd = true,
53 const BarrierData& barrierData = {}, const std::string& fxIndex = "");
54
55 void build(const QuantLib::ext::shared_ptr<ore::data::EngineFactory>& engineFactory) override;
56
57 //! Add underlying Commodity names
58 std::map<AssetClass, std::set<std::string>>
59 underlyingIndices(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager = nullptr) const override;
60
61 //! \name Inspectors
62 //@{
65 QuantLib::Real strike() const { return strike_; }
66 QuantLib::Real digitalCashPayoff() const { return digitalCashPayoff_; }
67 const std::string& currency() const { return currency_; }
68 const std::string& name() const { return name_; }
70 const std::string& startDate() const { return startDate_; }
71 const std::string& endDate() const { return endDate_; }
72 const std::string& paymentCalendar() const { return paymentCalendar_; }
73 const std::string& paymentLag() const { return paymentLag_; }
74 const std::string& paymentConvention() const { return paymentConvention_; }
75 const std::string& pricingCalendar() const { return pricingCalendar_; }
76 const std::string& paymentDate() const { return paymentDate_; }
77 QuantLib::Real gearing() const { return gearing_; }
78 QuantLib::Spread spread() const { return spread_; }
81 QuantLib::Natural futureMonthOffset() const { return futureMonthOffset_; }
82 QuantLib::Natural deliveryRollDays() const { return deliveryRollDays_; }
83 bool includePeriodEnd() const { return includePeriodEnd_; }
84 const std::string& fxIndex() const { return fxIndex_; }
85 //@}
86
87 //! \name Serialisation
88 //@{
89 virtual void fromXML(ore::data::XMLNode* node) override;
90 virtual ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
91 //@}
92
93 //! \name Trade
94 //@{
95 bool hasCashflows() const override { return false; }
96 //@}
97
98private:
101 QuantLib::Real strike_;
102 QuantLib::Real digitalCashPayoff_;
103 std::string currency_;
104 std::string name_;
106 std::string startDate_;
107 std::string endDate_;
108 std::string paymentCalendar_;
109 std::string paymentLag_;
111 std::string pricingCalendar_;
112 std::string paymentDate_;
113 QuantLib::Real gearing_;
114 QuantLib::Spread spread_;
117 QuantLib::Natural futureMonthOffset_;
118 QuantLib::Natural deliveryRollDays_;
120 std::string fxIndex_;
121};
122
123} // namespace data
124} // namespace ore
Serializable obejct holding barrier data.
Definition: barrierdata.hpp:34
CommodityDigitalAveragePriceOption(const ore::data::Envelope &envelope, const ore::data::OptionData &optionData, QuantLib::Real strike, QuantLib::Real digitalCashPayoff, const std::string &currency, const std::string &name, CommodityPriceType priceType, const std::string &startDate, const std::string &endDate, const std::string &paymentCalendar, const std::string &paymentLag, const std::string &paymentConvention, const std::string &pricingCalendar, const std::string &paymentDate="", QuantLib::Real gearing=1.0, QuantLib::Spread spread=0.0, QuantExt::CommodityQuantityFrequency commodityQuantityFrequency=QuantExt::CommodityQuantityFrequency::PerCalculationPeriod, CommodityPayRelativeTo commodityPayRelativeTo=CommodityPayRelativeTo::CalculationPeriodEndDate, QuantLib::Natural futureMonthOffset=0, QuantLib::Natural deliveryRollDays=0, bool includePeriodEnd=true, const BarrierData &barrierData={}, const std::string &fxIndex="")
QuantExt::CommodityQuantityFrequency commodityQuantityFrequency_
virtual void fromXML(ore::data::XMLNode *node) override
std::map< AssetClass, std::set< std::string > > underlyingIndices(const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager=nullptr) const override
Add underlying Commodity names.
void build(const QuantLib::ext::shared_ptr< ore::data::EngineFactory > &engineFactory) override
QuantExt::CommodityQuantityFrequency commodityQuantityFrequency() const
const ore::data::BarrierData & barrierData()
virtual ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
CommodityPayRelativeTo commodityPayRelativeTo() const
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
Serializable object holding option data.
Definition: optiondata.hpp:42
Trade base class.
Definition: trade.hpp:55
const Envelope & envelope() const
Definition: trade.hpp:135
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
leg data for commodity leg types
@ data
Definition: log.hpp:77
CommodityQuantityFrequency
Serializable Credit Default Swap.
Definition: namespaces.docs:23
trade option data model and serialization
base trade data model and serialization