YieldTermStructure Class Reference

### A free/open-source library for quantitative finance

YieldTermStructure Class Reference
Term structures

Interest-rate term structure. More...

`#include <ql/termstructures/yieldtermstructure.hpp>`

Inheritance diagram for YieldTermStructure:
[legend]

List of all members.

## Public Member Functions
Constructors
See the TermStructure documentation for issues regarding constructors.
| YieldTermStructure (const DayCounter &dc=DayCounter(), const std::vector< Handle< Quote > > &jumps=std::vector< Handle< Quote > >(), const std::vector< Date > &jumpDates=std::vector< Date >())
| YieldTermStructure (const Date &referenceDate, const Calendar &cal=Calendar(), const DayCounter &dc=DayCounter(), const std::vector< Handle< Quote > > &jumps=std::vector< Handle< Quote > >(), const std::vector< Date > &jumpDates=std::vector< Date >())
| YieldTermStructure (Natural settlementDays, const Calendar &cal, const DayCounter &dc=DayCounter(), const std::vector< Handle< Quote > > &jumps=std::vector< Handle< Quote > >(), const std::vector< Date > &jumpDates=std::vector< Date >())
Discount factors
These methods return the discount factor from a given date or time to the reference date. In the latter case, the time is calculated as a fraction of year from the reference date.
DiscountFactor | discount (const Date &d, bool extrapolate=false) const
DiscountFactor | discount (Time t, bool extrapolate=false) const
Zero-yield rates
These methods return the implied zero-yield rate for a given date or time. In the former case, the time is calculated as a fraction of year from the reference date.
InterestRate | zeroRate (const Date &d, const DayCounter &resultDayCounter, Compounding comp, Frequency freq=Annual, bool extrapolate=false) const
InterestRate | zeroRate (Time t, Compounding comp, Frequency freq=Annual, bool extrapolate=false) const
Forward rates
These methods returns the forward interest rate between two dates or times. In the former case, times are calculated as fractions of year from the reference date. If both dates (times) are equal the instantaneous forward rate is returned.
InterestRate | forwardRate (const Date &d1, const Date &d2, const DayCounter &resultDayCounter, Compounding comp, Frequency freq=Annual, bool extrapolate=false) const
InterestRate | forwardRate (const Date &d, const Period &p, const DayCounter &resultDayCounter, Compounding comp, Frequency freq=Annual, bool extrapolate=false) const
InterestRate | forwardRate (Time t1, Time t2, Compounding comp, Frequency freq=Annual, bool extrapolate=false) const
Jump inspectors
const std::vector< Date > & | jumpDates () const
const std::vector< Time > & | jumpTimes () const
Observer interface
void | update ()
## Protected Member Functions
Calculations
This method must be implemented in derived classes to perform the actual calculations. When it is called, range check has already been performed; therefore, it must assume that extrapolation is required.
virtual DiscountFactor | discountImpl (Time) const =0
| discount factor calculation

## Detailed Description

Interest-rate term structure.

This abstract class defines the interface of concrete interest rate structures which will be derived from this one.

Tests:
  observability against evaluation date changes is checked.

Examples:
  FittedBondCurve.cpp.

## Member Function Documentation

DiscountFactor discount | ( | Time | t,
|  | bool | extrapolate = `false`
| ) |  | const

The same day-counting rule used by the term structure should be used for calculating the passed time t.

InterestRate zeroRate | ( | const Date & | d,
|  | const DayCounter & | resultDayCounter,
|  | Compounding | comp,
|  | Frequency | freq = `Annual`,
|  | bool | extrapolate = `false`
| ) |  | const

The resulting interest rate has the required daycounting rule.

InterestRate zeroRate | ( | Time | t,
|  | Compounding | comp,
|  | Frequency | freq = `Annual`,
|  | bool | extrapolate = `false`
| ) |  | const

The resulting interest rate has the same day-counting rule used by the term structure. The same rule should be used for calculating the passed time t.

InterestRate forwardRate | ( | const Date & | d1,
|  | const Date & | d2,
|  | const DayCounter & | resultDayCounter,
|  | Compounding | comp,
|  | Frequency | freq = `Annual`,
|  | bool | extrapolate = `false`
| ) |  | const

The resulting interest rate has the required day-counting rule.

InterestRate forwardRate | ( | const Date & | d,
|  | const Period & | p,
|  | const DayCounter & | resultDayCounter,
|  | Compounding | comp,
|  | Frequency | freq = `Annual`,
|  | bool | extrapolate = `false`
| ) |  | const

The resulting interest rate has the required day-counting rule.

Warning:
  dates are not adjusted for holidays

InterestRate forwardRate | ( | Time | t1,
|  | Time | t2,
|  | Compounding | comp,
|  | Frequency | freq = `Annual`,
|  | bool | extrapolate = `false`
| ) |  | const

The resulting interest rate has the same day-counting rule used by the term structure. The same rule should be used for calculating the passed times t1 and t2.

void update | ( |  | ) | `[virtual]`

This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.

Reimplemented from TermStructure.

Reimplemented in FittedBondDiscountCurve, FlatForward, and PiecewiseZeroSpreadedTermStructure.