Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
asianoption.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 Skandinaviska Enskilda Banken AB (publ)
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 ORE is free software: you can redistribute it and/or modify it
8 under the terms of the Modified BSD License. You should have received a
9 copy of the license along with this program.
10 The license is also available online at <http://opensourcerisk.org>
11 This program is distributed on the basis that it will form a useful
12 contribution to risk analytics and model standardisation, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
15 */
16
17/*! \file portfolio/asianoption.hpp
18 \brief Asian Option data model
19 \ingroup tradedata
20*/
21
22#pragma once
23
29
30#include <ql/instruments/averagetype.hpp>
31
32namespace ore {
33namespace data {
34using std::string;
35
36//! Serializable Asian Option
37/*!
38 \ingroup tradedata
39*/
40class AsianOption : public Trade {
41public:
42 explicit AsianOption(const string& tradeType) : Trade(tradeType) {}
43 AsianOption(const Envelope& env, const string& tradeType, const double quantity, const TradeStrike& strike,
45 const QuantLib::ext::shared_ptr<Underlying>& underlying, const Date& settlementDate,
46 const std::string& currency)
49 currency_(currency) {}
50
51 //! Build QuantLib/QuantExt instrument, link pricing engine
52 void build(const QuantLib::ext::shared_ptr<EngineFactory>&) override;
53
54 //! Trade interface
55 QuantLib::Real notional() const override;
56 string notionalCurrency() const override;
57
58 //! \name Serialisation
59 //@{
60 virtual void fromXML(XMLNode* node) override;
61 virtual XMLNode* toXML(XMLDocument& doc) const override;
62 //@}
63
64 //! \name Inspectors
65 //@{
66 const string& asset() const { return assetName_; } // only available after build()
67 const TradeStrike& strike() const { return tradeStrike_; }
68 double quantity() const { return quantity_; }
69 const OptionData& option() const { return option_; }
71 const Date& settlementDate() const { return settlementDate_; }
72 const string& payCurrency() const { return currency_; }
73 const string& indexName() const {
75 return indexName_;
76 }
77 const QuantLib::ext::shared_ptr<Underlying>& underlying() const { return underlying_; }
78 //@}
79
80 // underlying asset names
81 std::map<AssetClass, std::set<std::string>>
82 underlyingIndices(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager = nullptr) const override;
83
84protected:
85 void populateIndexName() const;
86
87 double quantity_ = 0.0;
91 QuantLib::ext::shared_ptr<Underlying> underlying_;
93
94 string currency_;
95 string assetName_;
96
97 QuantLib::ext::shared_ptr<Trade> delegatingBuilderTrade_;
98
99 mutable string indexName_;
100};
101
103public:
104 EquityAsianOption() : AsianOption("EquityAsianOption") {}
106};
107
109public:
110 FxAsianOption() : AsianOption("FxAsianOption") {}
112};
113
115public:
116 CommodityAsianOption() : AsianOption("CommodityAsianOption") {}
118};
119
120} // namespace data
121} // namespace ore
Serializable Asian Option.
Definition: asianoption.hpp:40
const OptionData & option() const
Definition: asianoption.hpp:69
const QuantLib::ext::shared_ptr< Underlying > & underlying() const
Definition: asianoption.hpp:77
AsianOption(const string &tradeType)
Definition: asianoption.hpp:42
QuantLib::ext::shared_ptr< Trade > delegatingBuilderTrade_
Definition: asianoption.hpp:97
std::map< AssetClass, std::set< std::string > > underlyingIndices(const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager=nullptr) const override
const Date & settlementDate() const
Definition: asianoption.hpp:71
QuantLib::Real notional() const override
Trade interface.
virtual void fromXML(XMLNode *node) override
QuantLib::ext::shared_ptr< Underlying > underlying_
Definition: asianoption.hpp:91
virtual XMLNode * toXML(XMLDocument &doc) const override
AsianOption(const Envelope &env, const string &tradeType, const double quantity, const TradeStrike &strike, const OptionData &option, const ScheduleData &observationDates, const QuantLib::ext::shared_ptr< Underlying > &underlying, const Date &settlementDate, const std::string &currency)
Definition: asianoption.hpp:43
TradeStrike tradeStrike_
Definition: asianoption.hpp:88
const string & asset() const
Definition: asianoption.hpp:66
ScheduleData observationDates_
Definition: asianoption.hpp:90
double quantity() const
Definition: asianoption.hpp:68
const string & indexName() const
Definition: asianoption.hpp:73
const string & payCurrency() const
Definition: asianoption.hpp:72
string notionalCurrency() const override
const TradeStrike & strike() const
Definition: asianoption.hpp:67
void build(const QuantLib::ext::shared_ptr< EngineFactory > &) override
Build QuantLib/QuantExt instrument, link pricing engine.
Definition: asianoption.cpp:35
void populateIndexName() const
const ScheduleData & observationDates() const
Definition: asianoption.hpp:70
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
Serializable object holding option data.
Definition: optiondata.hpp:42
Serializable schedule data.
Definition: schedule.hpp:202
Trade base class.
Definition: trade.hpp:55
const string & tradeType() const
Definition: trade.hpp:133
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
Map text representations to QuantLib/QuantExt types.
base trade data model and serialization
Trade Factory.