26#ifndef quantlib_composite_zero_yield_structure
27#define quantlib_composite_zero_yield_structure
34 template <
class BinaryFunction>
39 const BinaryFunction&
f,
70 template <
class BinaryFunction>
74 const BinaryFunction&
f,
77 : curve1_(
std::move(h1)), curve2_(
std::move(h2)),
f_(
f), comp_(comp), freq_(freq) {
85 template <
class BinaryFunction>
87 return curve1_->dayCounter();
90 template <
class BinaryFunction>
92 return curve1_->calendar();
95 template <
class BinaryFunction>
97 return curve1_->settlementDays();
100 template <
class BinaryFunction>
102 return curve1_->referenceDate();
105 template <
class BinaryFunction>
110 template <
class BinaryFunction>
112 return curve1_->maxTime();
115 template <
class BinaryFunction>
117 if (!curve1_.empty() && !curve2_.empty()) {
119 enableExtrapolation(curve1_->allowsExtrapolation() && curve2_->allowsExtrapolation());
131 template <
class BinaryFunction>
134 curve1_->zeroRate(
t, comp_, freq_,
true);
137 curve2_->zeroRate(
t, comp_, freq_,
true);
139 InterestRate compositeRate(
f_(zeroRate1, zeroRate2), dayCounter(), comp_, freq_);
Calendar calendar() const override
the calendar used for reference and/or option date calculation
Rate zeroYieldImpl(Time) const override
returns the composite zero yield rate
Handle< YieldTermStructure > curve1_
const Date & referenceDate() const override
the date at which discount = 1.0 and/or variance = 0.0
Handle< YieldTermStructure > curve2_
CompositeZeroYieldStructure(Handle< YieldTermStructure > h1, Handle< YieldTermStructure > h2, const BinaryFunction &f, Compounding comp=Continuous, Frequency freq=NoFrequency)
Natural settlementDays() const override
the settlementDays used for reference date calculation
DayCounter dayCounter() const override
the day counter used for date/time conversion
Date maxDate() const override
the latest date for which the curve can return values
Time maxTime() const override
the latest time for which the curve can return values
static Date maxDate()
latest allowed date
Shared handle to an observable.
Concrete interest rate class.
InterestRate equivalentRate(Compounding comp, Frequency freq, Time t) const
equivalent interest rate for a compounding period t.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Zero-yield term structure.
ext::function< Real(Real)> f_
Frequency
Frequency of events.
@ NoFrequency
null frequency
Real Time
continuous quantity with 1-year units
unsigned QL_INTEGER Natural
positive integer
Compounding
Interest rate coumpounding rule.
Zero-yield based term structure.