C# Class CIRProcess.CIR

Inheritance: IExtensibleProcessIR, IMarkovSimulator, IParsable, IEstimationResultPopulable, IGreeksDerivativesInfo, IExportableContainer
Mostrar archivo Open project: fairmat/InterestRatesModels

Public Properties

Property Type Description
k IModelParameter
r0 IModelParameter
sigma IModelParameter
theta IModelParameter

Public Methods

Method Description
Bond ( IReadOnlyMatrixSlice dynamic, double dates, int i, double t, double s ) : double

Calculates the value of a Bond under the Cox-Ingersoll-Ross model.

CIR ( ) : System

Default constructor, sets all the values to a default of 0.001.

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.

Parse ( IProject context ) : bool

Ensure the parameters are correct.

Populate ( IStochasticProcess container, EstimationResult estimate ) : void

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

Setup ( double dates ) : void

Called by Simulator after parse. Calculates the variables d and nu for faster execution.

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

This function defines the drift in the Cox-Ingersoll-Ross Markov process. The formula to calculate the A component is A = k * (theta - max(previous state, 0)).

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

This function calculates the drift and the volatility in the Cox-Ingersoll-Ross Markov process. as A = k * (theta - max(previous state, 0)). B = sigma * sqrt(max(previous state, 0)).

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

This function defines the volatility in the Cox-Ingersoll-Ross Markov process. The formula to calculate the B component is B = sigma * sqrt(max(previous state, 0)).

isLog ( bool &isLog ) : void

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

Private Methods

Method Description
SetParametersValue ( ) : void

Prepares the serialized model parameters with the provided values.

Method Details

Bond() public method

Calculates the value of a Bond under the Cox-Ingersoll-Ross model.
public Bond ( IReadOnlyMatrixSlice dynamic, double dates, int i, double t, double s ) : 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. ///
s double /// The maturity of the bond. ///
return double

CIR() public method

Default constructor, sets all the values to a default of 0.001.
public CIR ( ) : System
return System

ExportObjects() public method

Creates a list of all the sub-objects that can be edited.
public ExportObjects ( bool recursive ) : List
recursive bool /// The parameter is not used. ///
return List

GetDeltaFactors() public method

Gets the factors for Delta Greek derivative.
public GetDeltaFactors ( ) : IModelParameter[]
return IModelParameter[]

GetVegaFactors() public method

Gets the factors for Vega Greek derivative.
public GetVegaFactors ( ) : IModelParameter[]
return IModelParameter[]

Parse() public method

Ensure the parameters are correct.
public Parse ( IProject context ) : bool
context IProject /// The underlying project. ///
return bool

Populate() public method

Populate editable fields from name and value vectors specific to the CIR process.
public Populate ( IStochasticProcess container, EstimationResult estimate ) : void
container IStochasticProcess /// The stochastic process which is being referenced to. ///
estimate EstimationResult /// The estimation result which contains values and names of parameters. ///
return void

Setup() public method

Called by Simulator after parse. Calculates the variables d and nu for faster execution.
public Setup ( double dates ) : void
dates double The parameter is not used.
return void

a() public method

This function defines the drift in the Cox-Ingersoll-Ross Markov process. The formula to calculate the A component is A = k * (theta - max(previous state, 0)).
public a ( int i, double x, double a ) : void
i int The parameter is not used.
x double The state vector at the previous state.
a double The output of the function.
return void

ab() public method

This function calculates the drift and the volatility in the Cox-Ingersoll-Ross Markov process. as A = k * (theta - max(previous state, 0)). B = sigma * sqrt(max(previous state, 0)).
public ab ( int i, double x, double a, double b ) : void
i int The parameter is not used.
x double The state vector at the previous state.
a double
b double The output of the function.
return void

b() public method

This function defines the volatility in the Cox-Ingersoll-Ross Markov process. The formula to calculate the B component is B = sigma * sqrt(max(previous state, 0)).
public b ( int i, double x, double b ) : void
i int The parameter is not used.
x double The state vector at the previous state.
b double The output of the function.
return void

isLog() public method

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. /// The array contains a single member set to false as this simulation /// is not log-normal. ///
return void

Property Details

k public_oe property

The k parameter of the model. It's the mean reversion speed.
public IModelParameter k
return IModelParameter

r0 public_oe property

The starting point for the model.
public IModelParameter r0
return IModelParameter

sigma public_oe property

The sigma parameter of the model. It's the volatility.
public IModelParameter sigma
return IModelParameter

theta public_oe property

The theta parameter of the model. It's the long term mean.
public IModelParameter theta
return IModelParameter