Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
capfloor.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 Quaternion Risk Management Ltd
3 Copyright (C) 2021 Skandinaviska Enskilda Banken AB (publ)
4 All rights reserved.
5
6 This file is part of ORE, a free-software/open-source library
7 for transparent pricing and risk analysis - http://opensourcerisk.org
8
9 ORE is free software: you can redistribute it and/or modify it
10 under the terms of the Modified BSD License. You should have received a
11 copy of the license along with this program.
12 The license is also available online at <http://opensourcerisk.org>
13
14 This program is distributed on the basis that it will form a useful
15 contribution to risk analytics and model standardisation, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file portfolio/capfloor.hpp
21 \brief Ibor cap, floor or collar trade data model and serialization
22 \ingroup tradedata
23*/
24
25#pragma once
26
30
31namespace ore {
32namespace data {
33
34//! Serializable cap, floor, collar
35/*! \ingroup tradedata
36 */
37class CapFloor : public Trade {
38public:
39 CapFloor() : Trade("CapFloor") {}
40 CapFloor(const Envelope& env, const string& longShort, const LegData& leg, const vector<double>& caps,
41 const vector<double>& floors, const PremiumData& premiumData = {})
42 : Trade("CapFloor", env), longShort_(longShort), legData_(leg), caps_(caps), floors_(floors),
43 premiumData_(premiumData) {}
44
45 virtual void build(const QuantLib::ext::shared_ptr<EngineFactory>&) override;
46
47 //! Inspectors
48 //@{
49 const string& longShort() const { return longShort_; }
50 const LegData& leg() const { return legData_; }
51 const vector<double>& caps() const { return caps_; }
52 const vector<double>& floors() const { return floors_; }
53 //@}
54
55 virtual void fromXML(XMLNode* node) override;
56 virtual XMLNode* toXML(XMLDocument& doc) const override;
57
58 //! \name Trade
59 //@{
60 bool hasCashflows() const override { return true; }
61 //@}
62
63 const std::map<std::string, boost::any>& additionalData() const override;
64
65private:
66 string longShort_;
68 vector<double> caps_;
69 vector<double> floors_;
71};
72} // namespace data
73} // namespace ore
Serializable cap, floor, collar.
Definition: capfloor.hpp:37
const vector< double > & floors() const
Definition: capfloor.hpp:52
CapFloor(const Envelope &env, const string &longShort, const LegData &leg, const vector< double > &caps, const vector< double > &floors, const PremiumData &premiumData={})
Definition: capfloor.hpp:40
const string & longShort() const
Inspectors.
Definition: capfloor.hpp:49
vector< double > floors_
Definition: capfloor.hpp:69
const LegData & leg() const
Definition: capfloor.hpp:50
virtual void fromXML(XMLNode *node) override
Definition: capfloor.cpp:778
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: capfloor.cpp:788
const vector< double > & caps() const
Definition: capfloor.hpp:51
PremiumData premiumData_
Definition: capfloor.hpp:70
vector< double > caps_
Definition: capfloor.hpp:68
bool hasCashflows() const override
Definition: capfloor.hpp:60
virtual void build(const QuantLib::ext::shared_ptr< EngineFactory > &) override
Definition: capfloor.cpp:49
const std::map< std::string, boost::any > & additionalData() const override
returns all additional data returned by the trade once built
Definition: capfloor.cpp:508
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
Serializable object holding leg data.
Definition: legdata.hpp:844
Serializable object holding premium data.
Definition: premiumdata.hpp:37
Trade base class.
Definition: trade.hpp:55
Trade()
Default constructor.
Definition: trade.hpp:59
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
Trade Factory.