24#ifndef quantext_weighted_yts_hpp
25#define quantext_weighted_yts_hpp
27#include <ql/termstructures/yieldtermstructure.hpp>
40 const Real w1,
const Real w2)
41 : YieldTermStructure(yts1->dayCounter()),
yts1_(yts1),
yts2_(yts2),
w1_(w1),
w2_(w2) {
42 QL_REQUIRE(yts1->dayCounter() == yts2->dayCounter(),
43 "WeightedYieldTermStructure(): sources have inconsistent day counters ("
44 << yts1->dayCounter().name() <<
" vs. " << yts2->dayCounter().name());
62 QL_REQUIRE(
yts1_->referenceDate() ==
yts2_->referenceDate(),
63 "WeightedYieldTermStructure::referenceDate(): inconsistent reference dates in sources ("
64 <<
yts1_->referenceDate() <<
" vs. " <<
yts2_->referenceDate());
65 return yts1_->referenceDate();
69 return std::pow(
yts1_->discount(t),
w1_) * std::pow(
yts2_->discount(t),
w2_);
weighted yield term structure
const Date & referenceDate() const override
const Handle< YieldTermStructure > yts1_
Date maxDate() const override
Real discountImpl(Time t) const override
WeightedYieldTermStructure(const Handle< YieldTermStructure > &yts1, const Handle< YieldTermStructure > &yts2, const Real w1, const Real w2)
const Handle< YieldTermStructure > yts2_