QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Related Functions | List of all members
InterestRate Class Reference

Concrete interest rate class. More...

#include <ql/interestrate.hpp>

+ Collaboration diagram for InterestRate:

Public Member Functions

constructors
 InterestRate ()
 Default constructor returning a null interest rate. More...
 
 InterestRate (Rate r, DayCounter dc, Compounding comp, Frequency freq)
 Standard constructor. More...
 
conversions
 operator Rate () const
 
inspectors
Rate rate () const
 
const DayCounterdayCounter () const
 
Compounding compounding () const
 
Frequency frequency () const
 
discount/compound factor calculations
DiscountFactor discountFactor (Time t) const
 discount factor implied by the rate compounded at time t. More...
 
DiscountFactor discountFactor (const Date &d1, const Date &d2, const Date &refStart=Date(), const Date &refEnd=Date()) const
 discount factor implied by the rate compounded between two dates More...
 
Real compoundFactor (Time t) const
 compound factor implied by the rate compounded at time t. More...
 
Real compoundFactor (const Date &d1, const Date &d2, const Date &refStart=Date(), const Date &refEnd=Date()) const
 compound factor implied by the rate compounded between two dates More...
 

Static Public Member Functions

implied rate calculations
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. More...
 
static InterestRate impliedRate (Real compound, const DayCounter &resultDC, Compounding comp, Frequency freq, const Date &d1, const Date &d2, const Date &refStart=Date(), const Date &refEnd=Date())
 implied rate for a given compound factor between two dates. More...
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &, const InterestRate &)
 

equivalent rate calculations

Rate r_
 
DayCounter dc_
 
Compounding comp_
 
bool freqMakesSense_
 
Real freq_
 
InterestRate equivalentRate (Compounding comp, Frequency freq, Time t) const
 equivalent interest rate for a compounding period t. More...
 
InterestRate equivalentRate (const DayCounter &resultDC, Compounding comp, Frequency freq, Date d1, Date d2, const Date &refStart=Date(), const Date &refEnd=Date()) const
 equivalent rate for a compounding period between two dates More...
 

Detailed Description

Concrete interest rate class.

This class encapsulate the interest rate compounding algebra. It manages day-counting conventions, compounding conventions, conversion between different conventions, discount/compound factor calculations, and implied/equivalent rate calculations.

Tests:
Converted rates are checked against known good results
Examples
CallableBonds.cpp.

Definition at line 40 of file interestrate.hpp.

Constructor & Destructor Documentation

◆ InterestRate() [1/2]

Default constructor returning a null interest rate.

Definition at line 30 of file interestrate.cpp.

+ Here is the caller graph for this function:

◆ InterestRate() [2/2]

InterestRate ( Rate  r,
DayCounter  dc,
Compounding  comp,
Frequency  freq 
)

Standard constructor.

Definition at line 33 of file interestrate.cpp.

Member Function Documentation

◆ operator Rate()

operator Rate ( ) const

Definition at line 51 of file interestrate.hpp.

◆ rate()

Rate rate ( ) const

Definition at line 55 of file interestrate.hpp.

+ Here is the caller graph for this function:

◆ dayCounter()

const DayCounter & dayCounter ( ) const

Definition at line 56 of file interestrate.hpp.

+ Here is the caller graph for this function:

◆ compounding()

Compounding compounding ( ) const

Definition at line 57 of file interestrate.hpp.

+ Here is the caller graph for this function:

◆ frequency()

Frequency frequency ( ) const

Definition at line 58 of file interestrate.hpp.

+ Here is the caller graph for this function:

◆ discountFactor() [1/2]

DiscountFactor discountFactor ( Time  t) const

discount factor implied by the rate compounded at time t.

Warning:
Time must be measured using InterestRate's own day counter.

Definition at line 69 of file interestrate.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ discountFactor() [2/2]

DiscountFactor discountFactor ( const Date d1,
const Date d2,
const Date refStart = Date(),
const Date refEnd = Date() 
) const

discount factor implied by the rate compounded between two dates

Definition at line 74 of file interestrate.hpp.

+ Here is the call graph for this function:

◆ compoundFactor() [1/2]

Real compoundFactor ( Time  t) const

compound factor implied by the rate compounded at time t.

returns the compound (a.k.a capitalization) factor implied by the rate compounded at time t.

Warning:
Time must be measured using InterestRate's own day counter.

Definition at line 44 of file interestrate.cpp.

+ Here is the caller graph for this function:

◆ compoundFactor() [2/2]

Real compoundFactor ( const Date d1,
const Date d2,
const Date refStart = Date(),
const Date refEnd = Date() 
) const

compound factor implied by the rate compounded between two dates

returns the compound (a.k.a capitalization) factor implied by the rate compounded between two dates.

Definition at line 98 of file interestrate.hpp.

+ Here is the call graph for this function:

◆ impliedRate() [1/2]

InterestRate impliedRate ( Real  compound,
const DayCounter resultDC,
Compounding  comp,
Frequency  freq,
Time  t 
)
static

implied interest rate for a given compound factor at a given time.

The resulting InterestRate has the day-counter provided as input.

Warning:
Time must be measured using the day-counter provided as input.

Definition at line 70 of file interestrate.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ impliedRate() [2/2]

static InterestRate impliedRate ( Real  compound,
const DayCounter resultDC,
Compounding  comp,
Frequency  freq,
const Date d1,
const Date d2,
const Date refStart = Date(),
const Date refEnd = Date() 
)
static

implied rate for a given compound factor between two dates.

The resulting rate is calculated taking the required day-counting rule into account.

Definition at line 129 of file interestrate.hpp.

+ Here is the call graph for this function:

◆ equivalentRate() [1/2]

InterestRate equivalentRate ( Compounding  comp,
Frequency  freq,
Time  t 
) const

equivalent interest rate for a compounding period t.

The resulting InterestRate shares the same implicit day-counting rule of the original InterestRate instance.

Warning:
Time must be measured using the InterestRate's own day counter.

Definition at line 155 of file interestrate.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ equivalentRate() [2/2]

InterestRate equivalentRate ( const DayCounter resultDC,
Compounding  comp,
Frequency  freq,
Date  d1,
Date  d2,
const Date refStart = Date(),
const Date refEnd = Date() 
) const

equivalent rate for a compounding period between two dates

The resulting rate is calculated taking the required day-counting rule into account.

Definition at line 165 of file interestrate.hpp.

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream &  ,
const InterestRate  
)
related

Definition at line 115 of file interestrate.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ r_

Rate r_
private

Definition at line 181 of file interestrate.hpp.

◆ dc_

DayCounter dc_
private

Definition at line 182 of file interestrate.hpp.

◆ comp_

Compounding comp_
private

Definition at line 183 of file interestrate.hpp.

◆ freqMakesSense_

bool freqMakesSense_
private

Definition at line 184 of file interestrate.hpp.

◆ freq_

Real freq_
private

Definition at line 185 of file interestrate.hpp.