CFL EXAMPLES
Functions
Construction of data curves.

Functions

cfl::Function prb::yieldShapeHullWhite (double dLambda, double dInitialTime)
 
cfl::Function prb::discountLogLinearInterp (const std::vector< double > &rDiscountTimes, const std::vector< double > &rDiscountFactors, double dInitialTime)
 
cfl::Function prb::discountFitHullWhite (const std::vector< double > &rDiscountTimes, const std::vector< double > &rDiscountFactors, double dLambda, double dInitialTime)
 

Detailed Description

This module contains functions that construct input data curves, such as volatility, forward, and discount, for financial models.

Function Documentation

cfl::Function prb::discountFitHullWhite ( const std::vector< double > &  rDiscountTimes,
const std::vector< double > &  rDiscountFactors,
double  dLambda,
double  dInitialTime 
)

Returns the stationary form of discount curve in Hull and White model by the least square fit of market yields. In the stationary form the discount factor with maturity $ t $ is given by

\[ d(t) = \exp\left(-A \left(\frac{1-e^{-\lambda (t-t_0)}}{\lambda}\right)\right), \]

where $\lambda$ (= dLambda) is the mean reversion rate, $t_0$ (= dInitialTime) is the initial time and $A$ is a constant determined from the least square fit.

Parameters
rDiscountTimesThe vector of times when discount factors are known.
rDiscountFactorsThe vector of known discount factors.
dLambdaThe mean-reversion rate.
dInitialTimeThe initial time.
Returns
The stationary form of discount curve in Hull and White model obtained from known discount factors by least square fit.
cfl::Function prb::discountLogLinearInterp ( const std::vector< double > &  rDiscountTimes,
const std::vector< double > &  rDiscountFactors,
double  dInitialTime 
)

Computes discount curve by log-linear interpolation of a given collection of discount factors.

Parameters
rDiscountTimesThe vector of times, when the discount factors are known.
rDiscountFactorsThe vector of known discount factors.
dInitialTimeThe initial time.
Returns
The discount curve obtained from known discount factors by log-linear interpolation.
cfl::Function prb::yieldShapeHullWhite ( double  dLambda,
double  dInitialTime 
)

Computes the stationary form for changes in yield curve in the framework of Hull and White model. In other words, returns the function

\[ \Gamma(t) = \frac{1 - \exp(-\lambda (t-t_0))}{\lambda (t-t_0)}, \]

where $\lambda$ (= dLambda) is the mean-reversion parameter, $t$ is the maturity, and $t_0$ (= dInitialTime) is the initial time.

Parameters
dLambdaThe mean-reversion parameter.
dInitialTimeThe initial time.
Returns
The stationary form of changes in yield shape curve for Hull and White model.