Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
commodityoption.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 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/commodityoption.hpp
20 \brief Commodity option representation
21 \ingroup tradedata
22*/
23
24#pragma once
25
28
29namespace ore {
30namespace data {
31
32//! Commodity option trade representation
33/*! \ingroup tradedata
34 */
36public:
37 //! Default constructor
39
40 //! Detailed constructor
41 CommodityOption(const Envelope& env, const OptionData& optionData, const std::string& commodityName,
42 const std::string& currency, QuantLib::Real quantity, TradeStrike strike,
43 const boost::optional<bool>& isFuturePrice = boost::none,
44 const QuantLib::Date& futureExpiryDate = QuantLib::Date());
45
46 //! Build underlying instrument and link pricing engine
47 void build(const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory) override;
48
49 //! Add underlying Commodity names
50 std::map<AssetClass, std::set<std::string>>
51 underlyingIndices(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager = nullptr) const override;
52
53 //! \name Serialisation
54 //@{
55 virtual void fromXML(XMLNode* node) override;
56 virtual XMLNode* toXML(XMLDocument& doc) const override;
57 //@}
58
59 //! \name Trade
60 //@{
61 bool hasCashflows() const override { return false; }
62 //@}
63
64 //! \name Inspectors
65 //@{
66 const boost::optional<bool>& isFuturePrice() const { return isFuturePrice_; }
67 const QuantLib::Date& futureExpiryDate() const { return futureExpiryDate_; }
68 //@}
69
70private:
71 /*! Indicates if the option underlying is a commodity future settlement price, \c true, or a spot price \c false.
72 If not explicitly set, it is assumed to be \c true.
73 */
74 boost::optional<bool> isFuturePrice_;
75
76 /*! An explicit expiry date for the underlying future contract. This can be used if the option trade references a
77 future contract settlement price and the option's expiry date does not match the future contract expiry date.
78 */
79 QuantLib::Date futureExpiryDate_;
80};
81
82} // namespace data
83} // namespace ore
Commodity option trade representation.
const boost::optional< bool > & isFuturePrice() const
std::map< AssetClass, std::set< std::string > > underlyingIndices(const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager=nullptr) const override
Add underlying Commodity names.
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
CommodityOption(const Envelope &env, const OptionData &optionData, const std::string &commodityName, const std::string &currency, QuantLib::Real quantity, TradeStrike strike, const boost::optional< bool > &isFuturePrice=boost::none, const QuantLib::Date &futureExpiryDate=QuantLib::Date())
Detailed constructor.
void build(const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory) override
Build underlying instrument and link pricing engine.
const QuantLib::Date & futureExpiryDate() const
CommodityOption()
Default constructor.
boost::optional< bool > isFuturePrice_
bool hasCashflows() const override
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
Serializable object holding option data.
Definition: optiondata.hpp:42
Serializable Vanilla Option.
const string & currency() const
TradeStrike strike() const
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
vanilla option representation