C# 클래스 HullAndWhiteTwoFactors.HW2

상속: HW2Context, IExtensibleProcessIR, IZeroRateReference, IMarkovSimulator, IParsable, IPopulable, IGreeksDerivativesInfo, IExportableContainer
파일 보기 프로젝트 열기: fairmat/InterestRatesModels

공개 프로퍼티들

프로퍼티 타입 설명
_a1 IModelParameter
_a2 IModelParameter
_rho IModelParameter
_s1 IModelParameter
_s2 IModelParameter

공개 메소드들

메소드 설명
Bond ( IReadOnlyMatrixSlice dynamic, double dates, int i, double t, double s ) : double

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

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.

HW2 ( ) : System

Initializes a new instance of the HullAndWhiteTwoFactors.HW2 class. This is the default constructor and sets the default values of several components of the model: * alpha 1 = 0.1 * sigma 1 = 0.001 * alpha 2 = 0.01 * sigma 2 = 0.001 * rho = 0.001 * No zero rate. * drift correction = 0.

Parse ( IProject p_Context ) : bool

Parses the data and ensures the parameters are correct.

Populate ( string names, double values ) : void

Populate editable fields from name and value vectors specific to HW2.

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.

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

This function calculates the drift in the HW2 Markov process.

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

This function updates the volatility parameters (vector b) of the HW2 process.

isLog ( bool &isLog ) : void

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

va ( int i, System.Matrix x, System.Matrix a ) : void

Vectorial version of method a.

보호된 메소드들

메소드 설명
DF ( double t, double dt ) : double

Numerically calculates the derivative of function F().

F ( double t, double dt ) : double

Numerically calculates the instantaneous forward rate.

Theta ( double t, double dt ) : double

Calculates the theta element of the Hull And White formula which will be stored in the theta in order to be used during simulation.

비공개 메소드들

메소드 설명
BondHW2 ( Project context, SPCache cache, HW2Context hw2, double R, double u, double PT, double P_t, double Pdt, double TT, double t, double dt ) : double

Price of a zcb at t > 0 with maturity TT > t as a function of the rate R, of the factor u at t and of the current zr curve (ZR) using the Hull & White two-factor model

dr = (theta(t) + u - a * r) * dt + sigma1 * dz1 du = -b * du * dt + sigma2 * dz2 with dz1 * dz2 = rho * dt

(see Hull-White (1994) Journal of Derivatives).

CalculateInnerModelParameters ( ) : void

Calculates and caches the model parameters for use during the simulation.

DPhi ( double t, double dt ) : double

Calculates either the right numerical derivative or the central numerical derivative of Phi.

OnDeserialized ( StreamingContext context ) : void
Phi ( double t ) : double

Calculates the standard normal cumulative distribution function.

Preprocessing ( ) : void

Does a preliminary processing of all the parameters and required data which will be used during the simulation.

ZCB ( double t ) : double

Calculates the value of a Zero Coupon Bond.

Zr ( double t ) : double

Evaluates the referenced zr.

메소드 상세

Bond() 공개 메소드

Calculates the value of a Bond under the Hull and White Two factors 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 variables must be sampled. ///
t double /// The date in years/fractions at at which the state variables must be sampled. ///
s double /// The maturity of the bond. ///
리턴 double

DF() 보호된 메소드

Numerically calculates the derivative of function F().
protected DF ( double t, double dt ) : double
t double /// Time at which calculate the derivative. ///
dt double /// Semi-interval to be used in the numerical derivative. ///
리턴 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

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

HW2() 공개 메소드

Initializes a new instance of the HullAndWhiteTwoFactors.HW2 class. This is the default constructor and sets the default values of several components of the model: * alpha 1 = 0.1 * sigma 1 = 0.001 * alpha 2 = 0.01 * sigma 2 = 0.001 * rho = 0.001 * No zero rate. * drift correction = 0.
public HW2 ( ) : System
리턴 System

Parse() 공개 메소드

Parses the data and ensures 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 HW2.
public Populate ( string names, double values ) : void
names string /// An array with the names of the variable, /// will search for alpha1 (or a1), sigma1 (or sigma), alpha2 (or a2), sigma2 and rho. ///
values double The values associated to the parameters in names.
리턴 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

Theta() 보호된 메소드

Calculates the theta element of the Hull And White formula which will be stored in the theta in order to be used during simulation.
protected Theta ( double t, double dt ) : double
t double The position in which this value will be calculated.
dt double The delta between this t position and the previous one.
리턴 double

a() 공개 메소드

This function calculates the drift in the HW2 Markov process.
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 drift,output of the function.
리턴 void

ab() 공개 메소드

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

b() 공개 메소드

This function updates the volatility parameters (vector b) of the HW2 process.
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 Booleans stating if the process components 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

va() 공개 메소드

Vectorial version of method a.
public va ( int i, System.Matrix x, System.Matrix a ) : void
i int The discrete time-step.
x System.Matrix The actual state matrix.
a System.Matrix The output drift matrix.
리턴 void

프로퍼티 상세

_a1 공개적으로 프로퍼티

Mean-reversion rate for r (short rate).
public IModelParameter _a1
리턴 IModelParameter

_a2 공개적으로 프로퍼티

Volatility of r (short rate).
public IModelParameter _a2
리턴 IModelParameter

_rho 공개적으로 프로퍼티

Mean-reversion rate for u (latent component).
public IModelParameter _rho
리턴 IModelParameter

_s1 공개적으로 프로퍼티

Mean-reversion rate for u (latent component).
public IModelParameter _s1
리턴 IModelParameter

_s2 공개적으로 프로퍼티

Mean-reversion rate for r (short rate).
public IModelParameter _s2
리턴 IModelParameter