Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
optionpaymentdata.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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/optionpaymentdata.hpp
20 \brief option payment data model and serialization
21 \ingroup tradedata
22*/
23
24#pragma once
25
27#include <ql/time/calendar.hpp>
28#include <ql/time/date.hpp>
29
30namespace ore {
31namespace data {
32
33/*! Serializable object holding option payment data for cash settled options.
34 \ingroup tradedata
35*/
37public:
38 //! When we have payment rules, specifies what date the payment is relative to.
39 enum class RelativeTo { Expiry, Exercise };
40
41 //! Default constructor
43
44 //! Constructor taking an explicit set of payment dates.
45 OptionPaymentData(const std::vector<std::string>& dates);
46
47 //! Constructor taking a set of payment rules.
48 OptionPaymentData(const std::string& lag, const std::string& calendar, const std::string& convention,
49 const std::string& relativeTo = "Expiry");
50
51 /*! Returns \c true if the OptionPaymentData was constructed using rules and \c false if it was constructed
52 using explicit payment dates.
53 */
54 bool rulesBased() const { return rulesBased_; }
55
56 //! \name Inspectors
57 //@{
58 const std::vector<QuantLib::Date>& dates() const { return dates_; }
59 QuantLib::Natural lag() const { return lag_; }
60 const QuantLib::Calendar& calendar() const { return calendar_; }
61 QuantLib::BusinessDayConvention convention() const { return convention_; }
62 RelativeTo relativeTo() const { return relativeTo_; }
63 //@}
64
65 //! \name Serialisation
66 //@{
67 virtual void fromXML(XMLNode* node) override;
68 virtual XMLNode* toXML(XMLDocument& doc) const override;
69 //@}
70
71private:
72 std::vector<std::string> strDates_;
73 std::string strLag_;
74 std::string strCalendar_;
75 std::string strConvention_;
76 std::string strRelativeTo_;
77
79 std::vector<QuantLib::Date> dates_;
80 QuantLib::Natural lag_;
82 QuantLib::BusinessDayConvention convention_;
84
85 //! Initialisation
86 void init();
87
88 //! Populate the value of relativeTo_ member from string.
89 void populateRelativeTo();
90};
91
92//! Print RelativeTo enum values.
93std::ostream& operator<<(std::ostream& out, const OptionPaymentData::RelativeTo& relativeTo);
94
95} // namespace data
96} // namespace ore
QuantLib::BusinessDayConvention convention() const
QuantLib::Natural lag() const
void populateRelativeTo()
Populate the value of relativeTo_ member from string.
std::vector< QuantLib::Date > dates_
virtual void fromXML(XMLNode *node) override
const QuantLib::Calendar & calendar() const
virtual XMLNode * toXML(XMLDocument &doc) const override
OptionPaymentData()
Default constructor.
const std::vector< QuantLib::Date > & dates() const
RelativeTo
When we have payment rules, specifies what date the payment is relative to.
QuantLib::BusinessDayConvention convention_
std::vector< std::string > strDates_
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
@ data
Definition: log.hpp:77
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
Serializable Credit Default Swap.
Definition: namespaces.docs:23
XML utility functions.