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 cbo.hpp
20 \brief collateralized bond obligation instrument
21*/
22
23#pragma once
24
25#include <ql/event.hpp>
26#include <ql/instrument.hpp>
27
30#include <ql/time/schedule.hpp>
31namespace QuantExt {
32using namespace QuantLib;
33
34//! Collateralized Bond Obligation, Cash Flow CBO
35/*!
36 This class holds the term sheet information on a generic Cashflow CBO
37 with arbitrary number of tranches.
38
39 The underlying bond basket is assumed to be in a single currency.
40
41 \ingroup instruments
42*/
43struct Tranche {
44 std::string name;
45 double faceAmount;
46 double icRatio;
47 double ocRatio;
48 QuantLib::Leg leg;
49};
50
51class CBO : public Instrument {
52public:
53 class arguments;
54 class results;
55 class engine;
56 //! \name Constructors
57 //@{
58 CBO( //! Underlying bond basket
59 const QuantLib::ext::shared_ptr<BondBasket>& basket,
60 //! CBO schedule
61 const QuantLib::Schedule& schedule,
62 //! Senior fee rate to be paid before any cash flow goes to the tranches
63 Rate seniorFee,
64 //! Fee day counter
65 const DayCounter& feeDayCounter,
66 //! Tranche description
67 const std::vector<Tranche>& tranches,
68 //! Subordinated fee rate to be paid late in the waterfal
69 Rate subordinatedFee,
70 //! Equity kicker
71 Rate equityKicker,
72 //! CBOs currency
73 const Currency& ccy,
74 //! invested trancheName
75 const std::string& investedTrancheName);
76 //@}
77 //! \name Inspectors
78 //@{
79 QuantLib::ext::shared_ptr<BondBasket> basket() const { return basket_; }
80 //@}
81
82 //! \name Instrument interface
83 //@{
84 bool isExpired() const override;
85 void setupArguments(PricingEngine::arguments*) const override;
86 void fetchResults(const PricingEngine::results*) const override;
87 //@}
88
89 //! \name Results
90 //@{
91 Real basketValue() const;
92 std::vector<Real> trancheValue() const;
93 Rate feeValue() const;
94 Rate subfeeValue() const;
95 Real basketValueStd() const;
96 std::vector<Real> trancheValueStd() const;
97 Rate feeValueStd() const;
98 Rate subfeeValueStd() const;
99 const std::vector<CashflowTable>& trancheCashflows() const;
100 //@}
101
102private:
103 void setupExpired() const override;
104
105 QuantLib::ext::shared_ptr<BondBasket> basket_;
106 Schedule schedule_;
108 DayCounter feeDayCounter_;
109 std::vector<Tranche> tranches_;
112 Currency ccy_;
114
115 mutable Real basketValue_;
116 mutable std::vector<Real> trancheValue_;
117 mutable Real feeValue_;
118 mutable Real subfeeValue_;
119 mutable Real basketValueStd_;
120 mutable std::vector<Real> trancheValueStd_;
121 mutable Real feeValueStd_;
122 mutable Real subfeeValueStd_;
123 mutable std::vector<CashflowTable> trancheCashflows_;
124};
125
127public:
128 void validate() const override;
129
130 QuantLib::ext::shared_ptr<BondBasket> basket;
131 Schedule schedule;
134 DayCounter feeDayCounter;
135 std::vector<Tranche> tranches;
137 Currency ccy;
139
140};
141
143public:
144 void reset() override;
146 std::vector<Real> trancheValue;
150 std::vector<Real> trancheValueStd;
153 std::vector<CashflowTable> trancheCashflows;
154};
155
156} // namespace QuantExt
Basket of defaultable bonds.
Cashflow table to store cashflow calculation results.
QuantLib::ext::shared_ptr< BondBasket > basket
Definition: cbo.hpp:130
std::vector< Tranche > tranches
Definition: cbo.hpp:135
DayCounter feeDayCounter
Definition: cbo.hpp:134
std::string investedTrancheName
Definition: cbo.hpp:138
void validate() const override
Definition: cbo.cpp:130
CBO base engine.
Definition: cboengine.hpp:36
std::vector< CashflowTable > trancheCashflows
Definition: cbo.hpp:153
std::vector< Real > trancheValueStd
Definition: cbo.hpp:150
std::vector< Real > trancheValue
Definition: cbo.hpp:146
void reset() override
Definition: cbo.cpp:136
Real basketValueStd() const
Definition: cbo.cpp:61
Rate seniorFee_
Definition: cbo.hpp:107
std::string investedTrancheName_
Definition: cbo.hpp:113
Schedule schedule_
Definition: cbo.hpp:106
QuantLib::ext::shared_ptr< BondBasket > basket_
Definition: cbo.hpp:105
std::vector< Real > trancheValue_
Definition: cbo.hpp:116
QuantLib::ext::shared_ptr< BondBasket > basket() const
Definition: cbo.hpp:79
Rate subfeeValue() const
std::vector< Real > trancheValue() const
Definition: cbo.cpp:51
void setupArguments(PricingEngine::arguments *) const override
Definition: cbo.cpp:88
bool isExpired() const override
Definition: cbo.cpp:81
Rate subfeeValueStd() const
Real subfeeValueStd_
Definition: cbo.hpp:122
Real basketValue_
Definition: cbo.hpp:115
Currency ccy_
Definition: cbo.hpp:112
Rate subordinatedFee_
Definition: cbo.hpp:110
Real feeValueStd_
Definition: cbo.hpp:121
Real subfeeValue_
Definition: cbo.hpp:118
Rate feeValueStd() const
Definition: cbo.cpp:71
Real basketValueStd_
Definition: cbo.hpp:119
std::vector< Real > trancheValueStd_
Definition: cbo.hpp:120
std::vector< CashflowTable > trancheCashflows_
Definition: cbo.hpp:123
std::vector< Tranche > tranches_
Definition: cbo.hpp:109
void setupExpired() const override
Definition: cbo.cpp:118
DayCounter feeDayCounter_
Definition: cbo.hpp:108
void fetchResults(const PricingEngine::results *) const override
Definition: cbo.cpp:103
Rate feeValue() const
Definition: cbo.cpp:56
Real basketValue() const
Definition: cbo.cpp:46
const std::vector< CashflowTable > & trancheCashflows() const
Definition: cbo.cpp:76
Real feeValue_
Definition: cbo.hpp:117
std::vector< Real > trancheValueStd() const
Definition: cbo.cpp:66
Rate equityKicker_
Definition: cbo.hpp:111
Collateralized Bond Obligation, Cash Flow CBO.
Definition: cbo.hpp:43
double icRatio
Definition: cbo.hpp:46
QuantLib::Leg leg
Definition: cbo.hpp:48
std::string name
Definition: cbo.hpp:44
double faceAmount
Definition: cbo.hpp:45
double ocRatio
Definition: cbo.hpp:47