Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cbo.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 portfolio/cbo.hpp
20 \brief collateralized bond obligation data model
21 \ingroup portfolio
22*/
23
24#pragma once
25
32
33namespace ore {
34namespace data {
35
37public:
38 static constexpr const char* TYPE = "CBO";
40
42 std::string feeDayCounter;
43 std::string seniorFee;
44 std::string subordinatedFee;
45 std::string equityKicker;
46 std::string ccy;
48 std::vector<QuantLib::ext::shared_ptr<TrancheData>> trancheData;
50 std::string daycounter;
51 std::string paymentConvention;
52
53 void fromXML(XMLNode* node) override;
54 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
55 };
56
58 CboReferenceDatum(const string& id) : ReferenceDatum(TYPE, id) {}
59 CboReferenceDatum(const string& id, const CboStructure& cboStructure) : ReferenceDatum(TYPE, id), cboStructure_(cboStructure) {}
60
61 void fromXML(XMLNode* node) override;
62 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
63
64 const CboStructure& cbostructure() const { return cboStructure_; }
65 void setCboStructure(const CboStructure& cboStructure) { cboStructure_ = cboStructure; }
66
67private:
69};
70
71class CBO : public Trade {
72public:
73 CBO() : Trade("CBO") {}
74
75 //! Add underlying Bond names
76 std::map<AssetClass, std::set<std::string>>
77 underlyingIndices(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager = nullptr) const override;
78
79 // Trade interface
80 void build(const QuantLib::ext::shared_ptr<EngineFactory>&) override;
81 void fromXML(XMLNode* node) override;
82 XMLNode* toXML(XMLDocument& doc) const override;
83 QuantLib::Real notional() const override { return notional_; }
84 std::string notionalCurrency() const override { return ccy_; }
85
86 std::string investedTrancheName() { return investedTrancheName_; };
88 double underlyingMultiplier() { return multiplier_; }
89
90protected:
91 std::map<std::string, std::set<Date>> fixings_;
92
93private:
94
95 void populateFromCboReferenceData(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager);
96 void populateFromCboReferenceData(const QuantLib::ext::shared_ptr<CboReferenceDatum>& cboReferenceDatum);
97 void validateCbo();
98
99 QuantLib::ext::shared_ptr<QuantExt::BondBasket> bondbasket_;
101 std::string feeDayCounter_;
102 std::string seniorFee_;
103 std::string subordinatedFee_;
104 std::string equityKicker_;
105 std::string ccy_;
108 std::vector<QuantLib::ext::shared_ptr<TrancheData>> trancheData_;
110 std::string daycounter_;
113 std::string structureId_;
115
116};
117
119 void
120 build(const std::string& parentId, const QuantLib::ext::shared_ptr<Trade>& underlying,
121 const std::vector<Date>& valuationDates, const std::vector<Date>& paymentDates,
122 const std::string& fundingCurrency, const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory,
123 QuantLib::ext::shared_ptr<QuantLib::Index>& underlyingIndex, Real& underlyingMultiplier,
124 std::map<std::string, double>& indexQuantities, std::map<std::string, QuantLib::ext::shared_ptr<QuantExt::FxIndex>>& fxIndices,
125 Real& initialPrice, std::string& assetCurrency, std::string& creditRiskCurrency,
126 std::map<std::string, SimmCreditQualifierMapping>& creditQualifierMapping, Date& maturity,
127 const std::function<QuantLib::ext::shared_ptr<QuantExt::FxIndex>(
128 const QuantLib::ext::shared_ptr<Market> market, const std::string& configuration, const std::string& domestic,
129 const std::string& foreign, std::map<std::string, QuantLib::ext::shared_ptr<QuantExt::FxIndex>>& fxIndices)>&
130 getFxIndex,
131 const std::string& underlyingDerivativeId, RequiredFixings& fixings, std::vector<Leg>& returnLegs) const override;
132};
133
134} // namespace data
135} // namespace ore
credit bond basket data model and serialization
std::string investedTrancheName_
Currency ccy_
std::string investedTrancheName_
Definition: cbo.hpp:107
std::string notionalCurrency() const override
Definition: cbo.hpp:84
std::string ccy_
Definition: cbo.hpp:105
QuantLib::ext::shared_ptr< QuantExt::BondBasket > bondbasket_
Definition: cbo.hpp:99
const BondBasket & bondBasketData()
Definition: cbo.hpp:87
std::string reinvestmentEndDate_
Definition: cbo.hpp:106
double investedNotional_
Definition: cbo.hpp:112
std::string seniorFee_
Definition: cbo.hpp:102
std::map< std::string, std::set< Date > > fixings_
Definition: cbo.hpp:91
QuantLib::Real notional() const override
Return the current notional in npvCurrency. See individual sub-classes for the precise definition.
Definition: cbo.hpp:83
std::string subordinatedFee_
Definition: cbo.hpp:103
ScheduleData scheduleData_
Definition: cbo.hpp:109
std::string feeDayCounter_
Definition: cbo.hpp:101
std::string investedTrancheName()
Definition: cbo.hpp:86
std::string daycounter_
Definition: cbo.hpp:110
BondBasket bondbasketdata_
Definition: cbo.hpp:100
void populateFromCboReferenceData(const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager)
Definition: cbo.cpp:147
std::string equityKicker_
Definition: cbo.hpp:104
std::vector< QuantLib::ext::shared_ptr< TrancheData > > trancheData_
Definition: cbo.hpp:108
double underlyingMultiplier()
Definition: cbo.hpp:88
std::string structureId_
Definition: cbo.hpp:113
double multiplier_
Definition: cbo.hpp:114
void validateCbo()
Definition: cbo.cpp:427
std::string paymentConvention_
Definition: cbo.hpp:111
CboStructure cboStructure_
Definition: cbo.hpp:68
const CboStructure & cbostructure() const
Definition: cbo.hpp:64
void setCboStructure(const CboStructure &cboStructure)
Definition: cbo.hpp:65
CboReferenceDatum(const string &id)
Definition: cbo.hpp:58
void fromXML(XMLNode *node) override
Definition: cbo.cpp:347
XMLNode * toXML(ore::data::XMLDocument &doc) const override
Definition: cbo.cpp:354
static constexpr const char * TYPE
Definition: cbo.hpp:38
CboReferenceDatum(const string &id, const CboStructure &cboStructure)
Definition: cbo.hpp:59
Base class for reference data.
const std::string & id() const
void setType(const string &type)
setters
Serializable schedule data.
Definition: schedule.hpp:202
Trade base class.
Definition: trade.hpp:55
QuantLib::Real notional_
Definition: trade.hpp:202
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
@ data
Definition: log.hpp:77
Time maturity
Definition: utilities.cpp:66
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Reference data model and serialization.
void build(const std::string &parentId, const QuantLib::ext::shared_ptr< Trade > &underlying, const std::vector< Date > &valuationDates, const std::vector< Date > &paymentDates, const std::string &fundingCurrency, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, QuantLib::ext::shared_ptr< QuantLib::Index > &underlyingIndex, Real &underlyingMultiplier, std::map< std::string, double > &indexQuantities, std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > &fxIndices, Real &initialPrice, std::string &assetCurrency, std::string &creditRiskCurrency, std::map< std::string, SimmCreditQualifierMapping > &creditQualifierMapping, Date &maturity, const std::function< QuantLib::ext::shared_ptr< QuantExt::FxIndex >(const QuantLib::ext::shared_ptr< Market > market, const std::string &configuration, const std::string &domestic, const std::string &foreign, std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > &fxIndices)> &getFxIndex, const std::string &underlyingDerivativeId, RequiredFixings &fixings, std::vector< Leg > &returnLegs) const override
Definition: cbo.cpp:250
std::vector< QuantLib::ext::shared_ptr< TrancheData > > trancheData
Definition: cbo.hpp:48
void fromXML(XMLNode *node) override
Definition: cbo.cpp:290
XMLNode * toXML(ore::data::XMLDocument &doc) const override
Definition: cbo.cpp:323
base trade data model and serialization
cbo tranche data model and serialization