Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
balanceguaranteedswap.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 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/balanceguaranteedswap.hpp
20 \brief Balance Guaranteed Swap data model and serialization
21 \ingroup tradedata
22*/
23
24#pragma once
25
28
29namespace ore {
30namespace data {
31
32//! Serializable Tranche for use in Balance Guaranteed Swaps
33/*!
34 \ingroup tradedata
35*/
37public:
39 BGSTrancheData(const std::string& description, const std::string& securityId, const int seniority,
40 const std::vector<QuantLib::Real>& notionals, const std::vector<std::string>& notionalDates)
43
44 //! \name Inspectors
45 //@{
46 const std::string& description() const { return description_; }
47 const std::string& securityId() const { return securityId_; }
48 int seniority() const { return seniority_; }
49 const std::vector<QuantLib::Real>& notionals() const { return notionals_; }
50 const std::vector<std::string>& notionalDates() const { return notionalDates_; }
51 //@}
52
53 //! \name Serialisation
54 //@{
55 virtual void fromXML(ore::data::XMLNode* node) override;
56 virtual ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
57 //@}
58
59private:
60 std::string description_;
61 std::string securityId_;
63 std::vector<QuantLib::Real> notionals_;
64 std::vector<std::string> notionalDates_;
65};
66
67//! Serializable Balance Guaranteed Swap
68/*!
69 \ingroup tradedata
70*/
72public:
73 BalanceGuaranteedSwap() : Trade("BalanceGuaranteedSwap") {}
75 const std::vector<BGSTrancheData>& tranches, const ore::data::Schedule schedule,
76 const std::vector<ore::data::LegData>& swap)
77 : Trade("BalanceGuaranteedSwap", env), referenceSecurity_(referenceSecurity), tranches_(tranches), swap_(swap) {
78 }
79
80 void build(const QuantLib::ext::shared_ptr<ore::data::EngineFactory>&) override;
81
82 //! \name Inspectors
83 //@{
84 const std::string& referenceSecurity() const { return referenceSecurity_; }
85 const std::vector<BGSTrancheData>& tranches() const { return tranches_; }
86 const ore::data::ScheduleData schedule() const { return schedule_; }
87 const std::vector<ore::data::LegData>& swap() const { return swap_; }
88 //@}
89
90 //! \name Serialisation
91 //@{
92 virtual void fromXML(ore::data::XMLNode* node) override;
93 virtual ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
94 //@}
95
96 std::map<ore::data::AssetClass, std::set<std::string>>
97 underlyingIndices(const QuantLib::ext::shared_ptr<ore::data::ReferenceDataManager>&) const override {
99 }
100
101private:
103 std::vector<BGSTrancheData> tranches_;
105 std::vector<ore::data::LegData> swap_;
106};
107
108} // namespace data
109} // namespace ore
Serializable Tranche for use in Balance Guaranteed Swaps.
const std::vector< QuantLib::Real > & notionals() const
std::vector< std::string > notionalDates_
std::vector< QuantLib::Real > notionals_
virtual void fromXML(ore::data::XMLNode *node) override
const std::vector< std::string > & notionalDates() const
virtual ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
const std::string & description() const
const std::string & securityId() const
BGSTrancheData(const std::string &description, const std::string &securityId, const int seniority, const std::vector< QuantLib::Real > &notionals, const std::vector< std::string > &notionalDates)
Serializable Balance Guaranteed Swap.
const std::string & referenceSecurity() const
std::vector< ore::data::LegData > swap_
std::vector< BGSTrancheData > tranches_
virtual void fromXML(ore::data::XMLNode *node) override
const ore::data::ScheduleData schedule() const
const std::vector< BGSTrancheData > & tranches() const
const std::vector< ore::data::LegData > & swap() const
virtual ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
void build(const QuantLib::ext::shared_ptr< ore::data::EngineFactory > &) override
std::map< ore::data::AssetClass, std::set< std::string > > underlyingIndices(const QuantLib::ext::shared_ptr< ore::data::ReferenceDataManager > &) const override
BalanceGuaranteedSwap(const ore::data::Envelope &env, const std::string &referenceSecurity, const std::vector< BGSTrancheData > &tranches, const ore::data::Schedule schedule, const std::vector< ore::data::LegData > &swap)
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
Serializable schedule data.
Definition: schedule.hpp:202
Trade base class.
Definition: trade.hpp:55
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
leg data model and serialization
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
base trade data model and serialization