30 const Time dt = 0.0001;
39 const std::vector<Date>& jumpDates)
40 :
TermStructure(referenceDate, cal, dc), jumps_(
std::move(jumps)), jumpDates_(jumpDates),
41 jumpTimes_(jumpDates.size()), nJumps_(jumps_.size()) {
51 const std::vector<Date>& jumpDates)
52 :
TermStructure(settlementDays, cal, dc), jumps_(
std::move(jumps)), jumpDates_(jumpDates),
53 jumpTimes_(jumpDates.size()), nJumps_(jumps_.size()) {
68 "mismatch between number of jumps (" <<
nJumps_ <<
69 ") and jump dates (" <<
jumpDates_.size() <<
")");
77 bool extrapolate)
const {
90 "invalid " <<
io::ordinal(i+1) <<
" jump value: " <<
92 jumpEffect *= thisJump;
102 bool extrapolate)
const {
121 bool extrapolate)
const {
134 bool extrapolate)
const {
147 QL_REQUIRE(d1 < d2, d1 <<
" later than " << d2);
158 bool extrapolate)
const {
162 t1 = std::max(t1 - dt/2.0, 0.0);
166 QL_REQUIRE(t2>t1,
"t2 (" << t2 <<
") < t1 (" << t2 <<
")");
182 if (newReference ==
Date()) {
Shared handle to an observable.
Concrete interest rate class.
static InterestRate impliedRate(Real compound, const DayCounter &resultDC, Compounding comp, Frequency freq, Time t)
implied interest rate for a given compound factor at a given time.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Basic term-structure functionality.
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
Time timeFromReference(const Date &date) const
date/time conversion
void checkRange(const Date &d, bool extrapolate) const
date-range check
virtual DayCounter dayCounter() const
the day counter used for date/time conversion
std::vector< Date > jumpDates_
DiscountFactor discount(const Date &d, bool extrapolate=false) const
std::vector< Time > jumpTimes_
YieldTermStructure(const DayCounter &dc=DayCounter())
InterestRate zeroRate(const Date &d, const DayCounter &resultDayCounter, Compounding comp, Frequency freq=Annual, bool extrapolate=false) const
std::vector< Handle< Quote > > jumps_
void setJumps(const Date &referenceDate)
InterestRate forwardRate(const Date &d1, const Date &d2, const DayCounter &resultDayCounter, Compounding comp, Frequency freq=Annual, bool extrapolate=false) const
virtual DiscountFactor discountImpl(Time) const =0
discount factor calculation
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Frequency
Frequency of events.
detail::ordinal_holder ordinal(Size)
outputs naturals as 1st, 2nd, 3rd...
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
unsigned QL_INTEGER Natural
positive integer
std::size_t Size
size of a container
Compounding
Interest rate coumpounding rule.
Interest-rate term structure.