Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
vanillaoption.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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 portfolio/vanillaoption.hpp
20 \brief Vanilla Option data model
21 \ingroup tradedata
22*/
23
24#pragma once
25
30
31namespace ore {
32namespace data {
33using std::string;
34
35//! Serializable Vanilla Option
36/*!
37 \ingroup tradedata
38*/
39class VanillaOptionTrade : public Trade {
40public:
41 //! Build QuantLib/QuantExt instrument, link pricing engine
42 void build(const QuantLib::ext::shared_ptr<EngineFactory>&) override;
44
45 //! \name Inspectors
46 //@{
47 const OptionData& option() const { return option_; }
48 const string& asset() const { return assetName_; }
49 const string& currency() const { return currency_; }
50 TradeStrike strike() const { return strike_; }
51 double quantity() const { return quantity_; }
52 const QuantLib::Date forwardDate() const { return forwardDate_; }
53 const QuantLib::Date paymentDate() const { return paymentDate_; }
54 //@}
55
56protected:
57 VanillaOptionTrade(AssetClass assetClassUnderlying)
58 : Trade("VanillaOption"), assetClassUnderlying_(assetClassUnderlying), quantity_(0) {}
59 VanillaOptionTrade(const Envelope& env, AssetClass assetClassUnderlying, OptionData option, string assetName,
60 string currency, double quantity, TradeStrike strike,
61 const QuantLib::ext::shared_ptr<QuantLib::Index>& index = nullptr, const std::string& indexName = "",
62 QuantLib::Date forwardDate = QuantLib::Date())
63 : Trade("VanillaOption", env), assetClassUnderlying_(assetClassUnderlying), option_(option),
65 indexName_(indexName), forwardDate_(forwardDate) {}
66
69 string assetName_;
70 string currency_;
72 double quantity_;
74
75 //! An index is needed if the option is to be automatically exercised on expiry.
76 QuantLib::ext::shared_ptr<QuantLib::Index> index_;
77
78 //! Hold the external index name if needed e.g. in the case of an FX index.
79 std::string indexName_;
80
81 //! Store the option expiry date.
82 QuantLib::Date expiryDate_;
83
84 //! Store the (optional) forward date.
85 QuantLib::Date forwardDate_;
86
87 //! Store the (optional) payment date.
88 QuantLib::Date paymentDate_;
89};
90} // namespace data
91} // namespace ore
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
Serializable Vanilla Option.
const string & currency() const
const OptionData & option() const
VanillaOptionTrade(const Envelope &env, AssetClass assetClassUnderlying, OptionData option, string assetName, string currency, double quantity, TradeStrike strike, const QuantLib::ext::shared_ptr< QuantLib::Index > &index=nullptr, const std::string &indexName="", QuantLib::Date forwardDate=QuantLib::Date())
TradeStrike strike() const
VanillaOptionTrade(AssetClass assetClassUnderlying)
const QuantLib::Date forwardDate() const
QuantLib::Date expiryDate_
Store the option expiry date.
const string & asset() const
QuantLib::Date paymentDate_
Store the (optional) payment date.
const QuantLib::Date paymentDate() const
QuantLib::Date forwardDate_
Store the (optional) forward date.
std::string indexName_
Hold the external index name if needed e.g. in the case of an FX index.
QuantLib::ext::shared_ptr< QuantLib::Index > index_
An index is needed if the option is to be automatically exercised on expiry.
void build(const QuantLib::ext::shared_ptr< EngineFactory > &) override
Build QuantLib/QuantExt instrument, link pricing engine.
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
trade option data model and serialization
Map text representations to QuantLib/QuantExt types.
base trade data model and serialization