YieldTermStructure Class Reference
[Term structures]

Interest-rate term structure. More...

#include <ql/termstructures/yieldtermstructure.hpp>

Inheritance diagram for YieldTermStructure:

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
Par rates
These methods returns the implied par rate for a given sequence of payments at the given dates or times. In the former case, times are calculated as fractions of year from the reference date.

Warning:
though somewhat related to a swap rate, this method is not to be used for the fair rate of a real swap, since it does not take into account all the market conventions' details. The correct way to evaluate such rate is to instantiate a SimpleSwap with the correct conventions, pass it the term structure and call the swap's fairRate() method.


Rate parRate (Natural tenor, const Date &startDate, const DayCounter &resultDayCounter, Frequency freq=Annual, bool extrapolate=false) const
Rate parRate (const std::vector< Date > &dates, const DayCounter &resultDayCounter, Frequency freq=Annual, bool extrapolate=false) const
Rate parRate (const std::vector< Time > &times, 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.

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.

Rate parRate ( const std::vector< Date > &  dates,
const DayCounter resultDayCounter,
Frequency  freq = Annual,
bool  extrapolate = false 
) const

the first date in the vector must equal the start date; the following dates must equal the par rate payment dates.

Rate parRate ( const std::vector< Time > &  times,
Frequency  freq = Annual,
bool  extrapolate = false 
) const

the first time in the vector must equal the start time; the following times must equal the par rate payment times.

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.