Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
flexiswap.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/flexiswap.hpp
20 \brief Flexi-Swap data model and serialization
21 \ingroup tradedata
22*/
23
24#pragma once
25
28
29namespace ore {
30namespace data {
31
32//! Serializable Flexi-Swap
33/*!
34 \ingroup tradedata
35*/
37public:
38 FlexiSwap() : Trade("FlexiSwap") {}
39
40 /*! the optionality is described by lower notional bounds */
41 FlexiSwap(const ore::data::Envelope& env, const std::vector<ore::data::LegData>& swap,
42 const std::vector<double>& lowerNotionalBounds, const std::vector<std::string>& lowerNotionalBoundsDates,
43 const std::string& optionLongShort)
46
47 /*! the optionality is described by exercise dates / types and values */
48 FlexiSwap(const ore::data::Envelope& env, const std::vector<ore::data::LegData>& swap,
49 const std::string& noticePeriod, const std::string& noticeCalendar, const std::string& noticeConvention,
50 const std::vector<std::string>& exerciseDates, const std::vector<std::string>& exerciseTypes,
51 const std::vector<double>& exerciseValues, const std::string& optionLongShort)
55 QL_REQUIRE(exerciseDates_.size() == exerciseTypes.size(), "exercise dates (" << exerciseDates_.size()
56 << ") must match exercise types ("
57 << exerciseTypes.size() << ")");
58 QL_REQUIRE(exerciseDates_.size() == exerciseValues.size(),
59 "exercise dates (" << exerciseDates_.size() << ") must match exercise values ("
60 << exerciseTypes.size() << ")");
61 }
62
63 void build(const QuantLib::ext::shared_ptr<ore::data::EngineFactory>&) override;
64
65 //! \name Inspectors
66 //@{
67 const std::vector<ore::data::LegData>& swap() const { return swap_; }
68 // optionality described by lower notional bounds
69 const std::vector<double>& lowerNotionalBounds() const { return lowerNotionalBounds_; }
70 const std::vector<std::string>& lowerNotionalBoundsDates() const { return lowerNotionalBoundsDates_; }
71 // optionality described by exercise dates, types, values
72 const std::string& noticePeriod() const { return noticePeriod_; }
73 const std::string& noticeCalendar() const { return noticeCalendar_; }
74 const std::string& noticeConvention() const { return noticeConvention_; }
75 const std::vector<std::string>& exerciseDates() const { return exerciseDates_; }
76 const std::vector<std::string>& exerciseTypes() const { return exerciseTypes_; }
77 const std::vector<double>& exerciseValues() const { return exerciseValues_; }
78 // option long / short flag
79 const std::string& optionLongShort() const { return optionLongShort_; }
80 //@}
81
82 //! \name Serialisation
83 //@{
84 virtual void fromXML(ore::data::XMLNode* node) override;
85 virtual ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
86 //@}
87private:
88 std::vector<ore::data::LegData> swap_;
89 // optionality given by lower notional boudns
90 std::vector<double> lowerNotionalBounds_;
91 std::vector<std::string> lowerNotionalBoundsDates_;
92 // optionality given by exercise dates, types and values
94 std::vector<std::string> exerciseDates_, exerciseTypes_;
95 std::vector<double> exerciseValues_;
96 // long or short option
97 std::string optionLongShort_;
98
99 //! Store the name of the floating leg index
100 std::string floatingIndex_;
101};
102
103} // namespace data
104} // namespace ore
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
Serializable Flexi-Swap.
Definition: flexiswap.hpp:36
std::vector< double > lowerNotionalBounds_
Definition: flexiswap.hpp:90
std::vector< std::string > lowerNotionalBoundsDates_
Definition: flexiswap.hpp:91
std::string noticePeriod_
Definition: flexiswap.hpp:93
std::vector< double > exerciseValues_
Definition: flexiswap.hpp:95
std::vector< ore::data::LegData > swap_
Definition: flexiswap.hpp:88
const std::string & noticeConvention() const
Definition: flexiswap.hpp:74
const std::string & noticePeriod() const
Definition: flexiswap.hpp:72
virtual void fromXML(ore::data::XMLNode *node) override
Definition: flexiswap.cpp:246
const std::string & noticeCalendar() const
Definition: flexiswap.hpp:73
std::string floatingIndex_
Store the name of the floating leg index.
Definition: flexiswap.hpp:100
FlexiSwap(const ore::data::Envelope &env, const std::vector< ore::data::LegData > &swap, const std::vector< double > &lowerNotionalBounds, const std::vector< std::string > &lowerNotionalBoundsDates, const std::string &optionLongShort)
Definition: flexiswap.hpp:41
const std::vector< std::string > & lowerNotionalBoundsDates() const
Definition: flexiswap.hpp:70
std::string optionLongShort_
Definition: flexiswap.hpp:97
const std::vector< ore::data::LegData > & swap() const
Definition: flexiswap.hpp:67
virtual ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
Definition: flexiswap.cpp:285
std::vector< std::string > exerciseDates_
Definition: flexiswap.hpp:94
std::string noticeConvention_
Definition: flexiswap.hpp:93
const std::vector< std::string > & exerciseTypes() const
Definition: flexiswap.hpp:76
const std::vector< double > & lowerNotionalBounds() const
Definition: flexiswap.hpp:69
void build(const QuantLib::ext::shared_ptr< ore::data::EngineFactory > &) override
Definition: flexiswap.cpp:36
std::string noticeCalendar_
Definition: flexiswap.hpp:93
FlexiSwap(const ore::data::Envelope &env, const std::vector< ore::data::LegData > &swap, const std::string &noticePeriod, const std::string &noticeCalendar, const std::string &noticeConvention, const std::vector< std::string > &exerciseDates, const std::vector< std::string > &exerciseTypes, const std::vector< double > &exerciseValues, const std::string &optionLongShort)
Definition: flexiswap.hpp:48
const std::string & optionLongShort() const
Definition: flexiswap.hpp:79
std::vector< std::string > exerciseTypes_
Definition: flexiswap.hpp:94
const std::vector< double > & exerciseValues() const
Definition: flexiswap.hpp:77
const std::vector< std::string > & exerciseDates() const
Definition: flexiswap.hpp:75
Trade base class.
Definition: trade.hpp:55
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
leg data model and serialization
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
base trade data model and serialization