#include <qle/instruments/bondbasket.hpp>
Public Member Functions | |
BondBasket (const std::map< std::string, QuantLib::ext::shared_ptr< QuantLib::Bond > > &qlBonds, const std::map< std::string, double > &recoveries, const std::map< std::string, double > &multipliers, const std::map< std::string, QuantLib::Handle< QuantLib::YieldTermStructure > > &yieldTermStructures, const std::map< std::string, Currency > ¤cies, const QuantLib::ext::shared_ptr< QuantLib::Pool > pool, Currency baseCcy, const std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > &fxIndexMap, const QuantLib::Date &reinvestmentEndDate, const std::map< std::string, std::vector< double > > &reinvestmentScalar, const std::map< std::string, std::vector< std::string > > &flowType) | |
const std::map< std::string, QuantLib::ext::shared_ptr< QuantLib::Bond > > & | bonds () const |
Inspectors. More... | |
const QuantLib::ext::shared_ptr< QuantLib::Pool > & | pool () const |
const std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > & | fxIndexMap () const |
const std::set< QuantLib::Currency > | unique_currencies () const |
const double | recoveryRate (const std::string &name) const |
const double | multiplier (const std::string &name) const |
Real | convert (Real amount, Currency ccy, Date date=Date()) |
void | setGrid (std::vector< Date > dates) |
std::map< Currency, std::vector< Cash > > | scenarioCashflow (std::vector< Date > dates) |
std::map< Currency, std::vector< Cash > > | scenarioInterestflow (std::vector< Date > dates) |
std::map< Currency, std::vector< Cash > > | scenarioPrincipalflow (std::vector< Date > dates) |
std::map< Currency, std::vector< Real > > | scenarioRemainingNotional (std::vector< Date > dates) |
std::map< Currency, std::vector< Cash > > | scenarioLossflow (std::vector< Date > dates) |
std::map< Currency, std::vector< Cash > > | scenarioFeeflow (const std::vector< QuantLib::Date > &dates) |
void | fillFlowMaps () |
Private Member Functions | |
const double | getScalar (const std::string &name, const QuantLib::Date ¤tDate) const |
const QuantLib::Handle< QuantLib::YieldTermStructure > | yts (const std::string &name) const |
const Currency | currency (const std::string &name) const |
const std::vector< double > | reinvestmentScalar (const std::string &name) const |
const std::string | flowType (const std::string &name, int idx) const |
const QuantLib::ext::shared_ptr< QuantExt::FxIndex > | fxIndex (const std::string &name) const |
Private Attributes | |
const std::map< std::string, QuantLib::ext::shared_ptr< QuantLib::Bond > > | qlBonds_ |
const std::map< std::string, double > | recoveries_ |
const std::map< std::string, double > | multipliers_ |
const std::map< std::string, QuantLib::Handle< QuantLib::YieldTermStructure > > | yieldTermStructures_ |
const std::map< std::string, QuantLib::Currency > | currencies_ |
const QuantLib::ext::shared_ptr< QuantLib::Pool > | pool_ |
const Currency | baseCcy_ |
const std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > | fxIndexMap_ |
const Date | reinvestmentEndDate_ |
const std::map< std::string, std::vector< double > > | reinvestmentScalar_ |
const std::map< std::string, std::vector< std::string > > | flowType_ |
std::set< QuantLib::Currency > | unique_currencies_ |
std::vector< Date > | grid_ |
std::map< std::string, std::vector< int > > | cashflow2grid_ |
std::map< std::string, std::vector< int > > | interestflow2grid_ |
std::map< std::string, std::vector< int > > | notionalflow2grid_ |
std::map< std::string, std::vector< int > > | feeflow2grid_ |
std::map< std::string, std::vector< ext::shared_ptr< QuantLib::CashFlow > > > | cashflows_ |
std::map< std::string, std::vector< ext::shared_ptr< QuantLib::CashFlow > > > | interestFlows_ |
std::map< std::string, std::vector< ext::shared_ptr< QuantLib::CashFlow > > > | notionalFlows_ |
std::map< std::string, std::vector< ext::shared_ptr< QuantLib::CashFlow > > > | feeFlows_ |
Bond Basket.
This class holds a basket of defaultable bonds along with the pool of relevant names. There may be more bonds than names involved, e.g. several different bonds with same issuer.
The class provides tools for evaluating basket cash flows of different kinds (interest, principal) for scenarios of default times stored for all names involved in the Pool structure.
For further information refer to the detailed QuantExt documentation.
Definition at line 71 of file bondbasket.hpp.
BondBasket | ( | const std::map< std::string, QuantLib::ext::shared_ptr< QuantLib::Bond > > & | qlBonds, |
const std::map< std::string, double > & | recoveries, | ||
const std::map< std::string, double > & | multipliers, | ||
const std::map< std::string, QuantLib::Handle< QuantLib::YieldTermStructure > > & | yieldTermStructures, | ||
const std::map< std::string, Currency > & | currencies, | ||
const QuantLib::ext::shared_ptr< QuantLib::Pool > | pool, | ||
Currency | baseCcy, | ||
const std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > & | fxIndexMap, | ||
const QuantLib::Date & | reinvestmentEndDate, | ||
const std::map< std::string, std::vector< double > > & | reinvestmentScalar, | ||
const std::map< std::string, std::vector< std::string > > & | flowType | ||
) |
qlBonds | map of QuantLib bonds |
recoveries | recoveries per bonds |
multipliers | multipliers per bonds |
yieldTermStructures | discount curves per bonds |
currencies | currencies per bonds |
pool | Pool storing default time for all names involved in the basekt above |
baseCcy | Base currency |
fxIndexMap | Forex structure to compute spot and forward FX rates |
reinvestmentEndDate | end of reinvestment period |
reinvestmentScalar | scalar for reinvestment period per bonds |
flowType | flow types of cashflows per bonds |
Definition at line 130 of file bondbasket.cpp.
const std::map< std::string, QuantLib::ext::shared_ptr< QuantLib::Bond > > & bonds | ( | ) | const |
const QuantLib::ext::shared_ptr< Pool > & pool | ( | ) | const |
Pool of names with associated default times
Definition at line 167 of file bondbasket.cpp.
const std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > & fxIndexMap | ( | ) | const |
const std::set< QuantLib::Currency > unique_currencies | ( | ) | const |
const double recoveryRate | ( | const std::string & | name | ) | const |
Recovery rate for given name
Definition at line 171 of file bondbasket.cpp.
const double multiplier | ( | const std::string & | name | ) | const |
Multiplier for given name
Definition at line 178 of file bondbasket.cpp.
Real convert | ( | Real | amount, |
Currency | ccy, | ||
Date | date = Date() |
||
) |
FX conversion
Definition at line 115 of file bondbasket.cpp.
void setGrid | ( | std::vector< Date > | dates | ) |
Set the date grid for mapping cash flows. Store for each bond cash flow date the associated date grid bucket.
Definition at line 220 of file bondbasket.cpp.
std::map< Currency, vector< Cash > > scenarioCashflow | ( | std::vector< Date > | dates | ) |
Definition at line 268 of file bondbasket.cpp.
std::map< Currency, vector< Cash > > scenarioInterestflow | ( | std::vector< Date > | dates | ) |
Definition at line 314 of file bondbasket.cpp.
std::map< Currency, vector< Cash > > scenarioPrincipalflow | ( | std::vector< Date > | dates | ) |
Definition at line 345 of file bondbasket.cpp.
std::map< Currency, vector< Real > > scenarioRemainingNotional | ( | std::vector< Date > | dates | ) |
Definition at line 451 of file bondbasket.cpp.
std::map< Currency, vector< Cash > > scenarioLossflow | ( | std::vector< Date > | dates | ) |
Definition at line 420 of file bondbasket.cpp.
std::map< Currency, vector< Cash > > scenarioFeeflow | ( | const std::vector< QuantLib::Date > & | dates | ) |
Definition at line 390 of file bondbasket.cpp.
void fillFlowMaps | ( | ) |
Definition at line 43 of file bondbasket.cpp.
|
private |
Definition at line 28 of file bondbasket.cpp.
|
private |
Definition at line 185 of file bondbasket.cpp.
|
private |
Definition at line 192 of file bondbasket.cpp.
|
private |
Definition at line 199 of file bondbasket.cpp.
|
private |
Definition at line 206 of file bondbasket.cpp.
|
private |
Definition at line 213 of file bondbasket.cpp.
|
private |
Definition at line 139 of file bondbasket.hpp.
|
private |
Definition at line 140 of file bondbasket.hpp.
|
private |
Definition at line 141 of file bondbasket.hpp.
|
private |
Definition at line 142 of file bondbasket.hpp.
|
private |
Definition at line 143 of file bondbasket.hpp.
|
private |
Definition at line 144 of file bondbasket.hpp.
|
private |
Definition at line 145 of file bondbasket.hpp.
|
private |
Definition at line 146 of file bondbasket.hpp.
|
private |
Definition at line 147 of file bondbasket.hpp.
|
private |
Definition at line 148 of file bondbasket.hpp.
|
private |
Definition at line 149 of file bondbasket.hpp.
|
private |
Definition at line 151 of file bondbasket.hpp.
|
private |
Definition at line 152 of file bondbasket.hpp.
|
private |
Definition at line 154 of file bondbasket.hpp.
|
private |
Definition at line 155 of file bondbasket.hpp.
|
private |
Definition at line 156 of file bondbasket.hpp.
|
private |
Definition at line 157 of file bondbasket.hpp.
|
private |
Definition at line 159 of file bondbasket.hpp.
|
private |
Definition at line 160 of file bondbasket.hpp.
|
private |
Definition at line 161 of file bondbasket.hpp.
|
private |
Definition at line 162 of file bondbasket.hpp.