C# Класс HullAndWhiteOneFactor.HW1

Наследование: IExtensibleProcessIR, IZeroRateReference, IMarkovSimulator, IParsable, IEstimationResultPopulable, IGreeksDerivativesInfo, IOpenCLCode, IPostSimulationTransformation, IExportableContainer
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
alpha1 IModelParameter
sigma1 IModelParameter

Private Properties

Свойство Тип Описание
A double
AlphaInt double
B double
ExpectedAverageRate double
OnDeserialized void
ZR double

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

Метод Описание
Bond ( IReadOnlyMatrixSlice dynamic, double dates, int i, double t, double T ) : double

Calculates the value of a Bond under the Hull and White model.

ExpectedShortRate ( double t ) : double
ExportObjects ( bool recursive ) : List

Creates a list of all the sub-objects that can be edited.

GetDeltaFactors ( ) : IModelParameter[]

Gets the factors for Delta Greek derivative.

GetVegaFactors ( ) : IModelParameter[]

Gets the factors for Vega Greek derivative.

GetZeroRateReference ( ) : string

Gets the zero rate reference.

HW1 ( ) : System

Initializes a new instance of the HW1 class with alpha 0.1, sigma 0.001 and an empty zeroRateReference.

HW1 ( double alpha, double sigma, double lambda, string zeroRateReference ) : System

Initializes a new instance of the HW1 class given alpha, sigma, lambda and a zero rate reference.

HW1 ( double alpha, double sigma, string zeroRateReference ) : System

Initializes a new instance of the HW1 class given alpha, sigma and a zero rate reference.

Parse ( IProject p_Context ) : bool

Ensure the parameters are correct.

Populate ( IStochasticProcess stocProcess, EstimationResult estimate ) : void

Populate editable fields from name and value vectors specific to the Heston extended process.

SetZeroRateReference ( string zr ) : void

Associate the process to a zero rate defined in the Fairmat model (e.g. @zr1).

Setup ( double dates ) : void

Called by Simulator after parse. Initializes here time-dependant but not state dependent variables.

Simulate ( double Dates, IReadOnlyMatrixSlice Noise, IMatrixSlice OutDynamic ) : void
Transform ( double dates, IMatrixSlice outDynamic ) : void

Handles the conversion, after the simulation, from y to the short rate r.

a ( int i, double x, double a ) : void

This function defines the drift in the HW Markov process. The formula to calculate the A component is A = theta(t) - alpha * previous State.

ab ( int i, double x, double a, double b ) : void

This function defines drift and the volatility in the HW Markov process. The formula to calculate the B component is A = theta(t) - alpha * previous State. B = sigma.

b ( int i, double x, double b ) : void

This function defines the volatility in the HW Markov process. The formula to calculate the B component is B = sigma.

isLog ( bool &isLog ) : void

Sets the passed array with a Boolean stating if the process must be simulated as a log-normal process.

Защищенные методы

Метод Описание
F ( double t, double dt ) : double

Numerically calculates the instantaneous forward rate.

Ft ( double t, double dt ) : double

First derivative w.r.t time of forward rate

alphaTFunc ( double t, double dt ) : double

Calculates the value of alpha function at time t

theta ( double t, double dt ) : double

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

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

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

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.

ExpectedAverageRate ( double t ) : double
OnDeserialized ( StreamingContext context ) : void
ZR ( double t ) : double

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

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

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

Calculates the value of a Bond under the Hull and White model.
public Bond ( IReadOnlyMatrixSlice dynamic, double dates, int i, double t, double T ) : double
dynamic IReadOnlyMatrixSlice /// The simulated process. ///
dates double /// The vector of reference dates. ///
i int /// The index at which the state variable must be sampled. ///
t double /// The date in years/fractions at at which the state variable must be sampled. ///
T double /// The maturity of the bond. ///
Результат double

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

public ExpectedShortRate ( double t ) : double
t double
Результат double

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

Creates a list of all the sub-objects that can be edited.
public ExportObjects ( bool recursive ) : List
recursive bool /// The parameter is not used. ///
Результат List

F() защищенный Метод

Numerically calculates the instantaneous forward rate.
protected F ( double t, double dt ) : double
t double /// Time at which calculate the forward rate. ///
dt double /// Interval to be used in the numerical derivative. ///
Результат double

Ft() защищенный Метод

First derivative w.r.t time of forward rate
protected Ft ( double t, double dt ) : double
t double
dt double
Результат double

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

Gets the factors for Delta Greek derivative.
public GetDeltaFactors ( ) : IModelParameter[]
Результат IModelParameter[]

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

Gets the factors for Vega Greek derivative.
public GetVegaFactors ( ) : IModelParameter[]
Результат IModelParameter[]

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

Gets the zero rate reference.
public GetZeroRateReference ( ) : string
Результат string

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

Initializes a new instance of the HW1 class with alpha 0.1, sigma 0.001 and an empty zeroRateReference.
public HW1 ( ) : System
Результат System

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

Initializes a new instance of the HW1 class given alpha, sigma, lambda and a zero rate reference.
public HW1 ( double alpha, double sigma, double lambda, string zeroRateReference ) : System
alpha double The rate of the mean reversion to be used to initialize HW.
sigma double The standard deviation to be used to initialize HW.
lambda double The market price of risk to be used to initialize HW.
zeroRateReference string /// Reference to the zero rate to be used to initialize HW. ///
Результат System

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

Initializes a new instance of the HW1 class given alpha, sigma and a zero rate reference.
public HW1 ( double alpha, double sigma, string zeroRateReference ) : System
alpha double The rate of the mean reversion to be used to initialize HW.
sigma double The standard deviation to be used to initialize HW.
zeroRateReference string /// Reference to the zero rate to be used to initialize HW. ///
Результат System

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

Ensure the parameters are correct.
public Parse ( IProject p_Context ) : bool
p_Context IProject /// The underlying project. ///
Результат bool

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

Populate editable fields from name and value vectors specific to the Heston extended process.
public Populate ( IStochasticProcess stocProcess, EstimationResult estimate ) : void
stocProcess IStochasticProcess /// The stochastic process which is being referenced to. ///
estimate EstimationResult /// The estimation result which contains values and names of parameters. /// It will be searched for S0, kappa, theta, sigma, V0 and rho. ///
Результат void

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

Associate the process to a zero rate defined in the Fairmat model (e.g. @zr1).
public SetZeroRateReference ( string zr ) : void
zr string /// The zero rate reference. ///
Результат void

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

Called by Simulator after parse. Initializes here time-dependant but not state dependent variables.
public Setup ( double dates ) : void
dates double /// The dates at which the process realizations will be requested. ///
Результат void

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

public Simulate ( double Dates, IReadOnlyMatrixSlice Noise, IMatrixSlice OutDynamic ) : void
Dates double
Noise IReadOnlyMatrixSlice
OutDynamic IMatrixSlice
Результат void

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

Handles the conversion, after the simulation, from y to the short rate r.
public Transform ( double dates, IMatrixSlice outDynamic ) : void
dates double Simulation dates.
outDynamic IMatrixSlice The input and output components of the transformation.
Результат void

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

This function defines the drift in the HW Markov process. The formula to calculate the A component is A = theta(t) - alpha * previous State.
public a ( int i, double x, double a ) : void
i int The time step of the simulation.
x double The state vector at the previous state.
a double The output of the function.
Результат void

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

This function defines drift and the volatility in the HW Markov process. The formula to calculate the B component is A = theta(t) - alpha * previous State. B = sigma.
public ab ( int i, double x, double a, double b ) : void
i int The time step of the simulation.
x double The state vector at the previous state.
a double The output state dependent drift.
b double The output volatility.
Результат void

alphaTFunc() защищенный Метод

Calculates the value of alpha function at time t
protected alphaTFunc ( double t, double dt ) : double
t double Time at which calculate alpha
dt double
Результат double

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

This function defines the volatility in the HW Markov process. The formula to calculate the B component is B = sigma.
public b ( int i, double x, double b ) : void
i int The parameter is not used.
x double The parameter is not used.
b double The output of the function.
Результат void

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

Sets the passed array with a Boolean stating if the process must be simulated as a log-normal process.
public isLog ( bool &isLog ) : void
isLog bool /// A reference to the array to be set with the required information. ///
Результат void

theta() защищенный Метод

protected theta ( double t, double dt ) : double
t double
dt double
Результат double

Описание свойств

alpha1 защищенное свойство

Rate of mean reversion.
protected IModelParameter alpha1
Результат IModelParameter

sigma1 защищенное свойство

Standard deviation.
protected IModelParameter sigma1
Результат IModelParameter