24#ifndef quantext_yieldplusdefault_yts_hpp
25#define quantext_yieldplusdefault_yts_hpp
27#include <ql/termstructures/defaulttermstructure.hpp>
28#include <ql/termstructures/yieldtermstructure.hpp>
40 const std::vector<Handle<DefaultProbabilityTermStructure> >& df,
41 const std::vector<Handle<Quote> >& rr,
const std::vector<Real>& weights)
42 : YieldTermStructure(yts->dayCounter()),
yts_(yts),
df_(df),
rr_(rr),
weights_(weights) {
43 QL_REQUIRE(
df_.size() ==
weights_.size(),
"YieldPlusDefaultYieldTermStructure: default curve size ("
44 <<
df_.size() <<
") must match weights size (" <<
weights_.size()
46 QL_REQUIRE(
df_.size() ==
rr_.size(),
"YieldPlusDefaultYieldTermStructure: rec rate size ("
47 <<
rr_.size() <<
") must match weights size (" <<
weights_.size()
51 for (Size i = 0; i <
df_.size(); ++i)
53 for (Size i = 0; i <
rr_.size(); ++i)
61 const Handle<YieldTermStructure>
yts_;
62 const std::vector<Handle<DefaultProbabilityTermStructure> >
df_;
63 const std::vector<Handle<Quote> >
rr_;
73 return yts_->referenceDate();
77 Real d =
yts_->discount(t);
78 for (Size i = 0; i <
df_.size(); ++i) {
81 d *= std::pow(
df_[i]->survivalProbability(t),
weights_[i] * (1.0 -
rr_[i]->value()));
yield plus default yield term structure
const Handle< YieldTermStructure > yts_
const std::vector< Handle< DefaultProbabilityTermStructure > > df_
const Date & referenceDate() const override
const std::vector< Real > weights_
Date maxDate() const override
Real discountImpl(Time t) const override
YieldPlusDefaultYieldTermStructure(const Handle< YieldTermStructure > &yts, const std::vector< Handle< DefaultProbabilityTermStructure > > &df, const std::vector< Handle< Quote > > &rr, const std::vector< Real > &weights)
const std::vector< Handle< Quote > > rr_