Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
commodityswaption.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
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/commodityswaption.hpp
20 \brief Commodity swaption data model and serialization
21 \ingroup tradedata
22*/
23
24#pragma once
25
28
29namespace ore {
30namespace data {
31
32/*! Serializable Commodity Swap
33 \ingroup tradedata
34*/
36public:
37 CommoditySwaption() : ore::data::Trade("CommoditySwaption") {}
38
40 const std::vector<ore::data::LegData>& legData)
41 : Trade("CommoditySwaption", env), legData_(legData) {}
42
43 void build(const QuantLib::ext::shared_ptr<ore::data::EngineFactory>& engineFactory) override;
44 QuantLib::Real notional() const override;
45
46 //! Add underlying Commodity names
47 std::map<AssetClass, std::set<std::string>>
48 underlyingIndices(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager = nullptr) const override;
49
50 //! \name Inspectors
51 //@{
53 const std::vector<ore::data::LegData>& legData() const { return legData_; }
54 //@}
55
56 //! \name Serialisation
57 //@{
58 virtual void fromXML(ore::data::XMLNode* node) override;
59 virtual ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
60 //@}
61
62 //! \name Trade
63 //@{
64 bool hasCashflows() const override { return false; }
65 //@}
66
67private:
68 QuantLib::ext::shared_ptr<ore::data::LegData> createLegData() const { return QuantLib::ext::make_shared<ore::data::LegData>(); }
69
70 QuantLib::ext::shared_ptr<QuantLib::Swap> buildSwap(const QuantLib::ext::shared_ptr<ore::data::EngineFactory>& engineFactory);
71
73 vector<ore::data::LegData> legData_;
74 QuantLib::ext::shared_ptr<QuantLib::Exercise> exercise_;
75 std::string name_;
76 std::string ccy_;
77 QuantLib::Date startDate_;
78 QuantLib::ext::shared_ptr<CommoditySwap> commoditySwap_;
79};
80
81} // namespace data
82} // namespace ore
const std::vector< ore::data::LegData > & legData() const
vector< ore::data::LegData > legData_
ore::data::OptionData option_
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.
QuantLib::ext::shared_ptr< QuantLib::Exercise > exercise_
QuantLib::Real notional() const override
Return the current notional in npvCurrency. See individual sub-classes for the precise definition.
void build(const QuantLib::ext::shared_ptr< ore::data::EngineFactory > &engineFactory) override
QuantLib::ext::shared_ptr< CommoditySwap > commoditySwap_
virtual ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
QuantLib::ext::shared_ptr< ore::data::LegData > createLegData() const
CommoditySwaption(const ore::data::Envelope &env, const ore::data::OptionData &option, const std::vector< ore::data::LegData > &legData)
const ore::data::OptionData & option()
bool hasCashflows() const override
QuantLib::ext::shared_ptr< QuantLib::Swap > buildSwap(const QuantLib::ext::shared_ptr< ore::data::EngineFactory > &engineFactory)
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
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Commodity Swap data model and serialization.
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
trade option data model and serialization