C# Класс HullAndWhiteOneFactor.SwaptionHW1

This class provides closed form pricing of for Swaptions (the holder has the right to pay the fixed rate and receive floating rate) using the HW1 factor model.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
A ( double t, double T, double alpha, double sigma, System.Function zeroRateCurve ) : double

Calculates the function A() to be used in the Bond() method.

ForwardSwapRate ( double t, Vector T ) : double

Calculates the forward swap rate.

Func ( Vector x ) : double

Function to be used in the FSolve() problem of HWSwaption() method. This is a version done to double check the HW Swaption, with dt fixed to 0.001.

HWSwaption ( double a, double sigma, double l, double k, double T, Vector s ) : double

Price of a swaption in HW1 model: the holder has the right to pay the fixed rate and receive floating rate. This is a different version of the main one to do a double check of the swaption.

HWSwaption ( double a, double sigma, double l, double k, double swaptionMaturity, double swapDuration, double deltaK ) : double
HWSwaptionMatrix ( Vector swaptionMaturity, Vector swapDuration, double a, double sigma, double deltaK ) : System.Matrix

Calculates a matrix of swaption prices within Hull-White model.

SwaptionHW1 ( System.Function zeroratecurve ) : System

Initializes a new instance of the HullAndWhiteOneFactor.SwaptionHW1 class.

ZCBPut ( double a, double sigma, double L, double K, double T, double s ) : double

Calculates the value of a put option on a zero coupon bond.

alphaTFunc ( double t ) : double

Calculation of alpha function

Приватные методы

Метод Описание
AlphaInt ( double t, double T, double alpha, double sigma, System.Function zeroRateCurve ) : double

Calculates the integral of alpha function to be used in the A() method.

B ( double T, double alpha ) : double

Calculates the function B() to be used in the Bond() method.

F ( double t, double dt ) : double

Numerically calculates the instantaneous forward rate.

H ( double a, double sigma, double L, double K, double T, double s ) : double

Calculates H() function to be used in ZCBPut() method.

HWBond ( double a, double sigma, double r, Vector T, double t ) : Vector

Calculates a vector of zero coupon bond prices (discount factors) within the Hull-White model. This is a version done to double check the HW swaption.

PZC ( double t ) : double

Helper function to make functions easier to read. Just returns the value of the discount factor at position t. This is calculated with e^(-ZR(t)*t).

SigmaP ( double a, double sigma, double T, double s ) : double

Calculates SigmaP() function to be used in ZCBPut() method.

ZR ( double k ) : double

Helper function to make functions easier to read. Just returns the value of the zero rate at position k.

Описание методов

A() публичный статический Метод

Calculates the function A() to be used in the Bond() method.
public static A ( double t, double T, double alpha, double sigma, System.Function zeroRateCurve ) : double
t double /// The time at which the Bond price will be calculated. ///
T double /// The bond maturity. ///
alpha double /// Hull-White alpha parameter. ///
sigma double /// Hull-White sigma parameter. ///
zeroRateCurve System.Function /// Zero rate curve. ///
Результат double

ForwardSwapRate() публичный Метод

Calculates the forward swap rate.
public ForwardSwapRate ( double t, Vector T ) : double
t double /// The swap starting time. ///
T Vector /// The vector of swap payment times. ///
Результат double

Func() публичный Метод

Function to be used in the FSolve() problem of HWSwaption() method. This is a version done to double check the HW Swaption, with dt fixed to 0.001.
public Func ( Vector x ) : double
x Vector /// Vector of length 1 representing the variable on which the FSolve problem is performed. ///
Результат double

HWSwaption() публичный Метод

Price of a swaption in HW1 model: the holder has the right to pay the fixed rate and receive floating rate. This is a different version of the main one to do a double check of the swaption.
public HWSwaption ( double a, double sigma, double l, double k, double T, Vector s ) : double
a double /// Hull-White alpha parameter. ///
sigma double /// Hull-White sigma parameter. ///
l double /// The Notional. ///
k double /// The Strike. ///
T double /// The maturity. ///
s Vector /// Vector of swaption payment dates. ///
Результат double

HWSwaption() публичный Метод

public HWSwaption ( double a, double sigma, double l, double k, double swaptionMaturity, double swapDuration, double deltaK ) : double
a double
sigma double
l double
k double
swaptionMaturity double
swapDuration double
deltaK double
Результат double

HWSwaptionMatrix() публичный Метод

Calculates a matrix of swaption prices within Hull-White model.
public HWSwaptionMatrix ( Vector swaptionMaturity, Vector swapDuration, double a, double sigma, double deltaK ) : System.Matrix
swaptionMaturity Vector /// Vector of swaption maturity. ///
swapDuration Vector /// Vector of swap duration. ///
a double /// Hull-White alpha parameter. ///
sigma double /// Hull-White sigma parameter. ///
deltaK double /// Time interval between swap coupon expressed in year fraction. ///
Результат System.Matrix

SwaptionHW1() публичный Метод

Initializes a new instance of the HullAndWhiteOneFactor.SwaptionHW1 class.
public SwaptionHW1 ( System.Function zeroratecurve ) : System
zeroratecurve System.Function /// The zero-rate curve reference for the model. ///
Результат System

ZCBPut() публичный Метод

Calculates the value of a put option on a zero coupon bond.
public ZCBPut ( double a, double sigma, double L, double K, double T, double s ) : double
a double /// Hull-White alpha parameter. ///
sigma double /// Hull-White sigma parameter. ///
L double /// Zero coupon notional. ///
K double /// Bond rate. ///
T double /// The maturity of the option. ///
s double /// The maturity of the bond. ///
Результат double

alphaTFunc() публичный Метод

Calculation of alpha function
public alphaTFunc ( double t ) : double
t double Time at which calculate the alpha function
Результат double