C# 클래스 HullAndWhiteOneFactor.HW1

상속: IExtensibleProcessIR, IZeroRateReference, IMarkovSimulator, IParsable, IEstimationResultPopulable, IGreeksDerivativesInfo, IOpenCLCode, IPostSimulationTransformation, IExportableContainer
파일 보기 프로젝트 열기: fairmat/InterestRatesModels 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
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