C# Class HestonEstimator.HestonCall

Handles the calculation of the call prices on a given Heston model instance.
Inheritance: IIntegrable
ファイルを表示 Open project: fairmat/EquityModels Class Usage Examples

Public Methods

Method Description
HestonCall ( ) : System

Initializes a new instance of the HestonEstimator.HestonCall class.

HestonCallPrice ( Vector x, double s0, double T, double K, double r, double q ) : double

Calculates the Heston model call price.

Note that this function is a wrapper for the other one which sets all the variables locally before calling it.

IntegrandFunc ( double u ) : double

Calculates value of the integrand function that appears in the Heston model call price formula.

IntegrandFunc ( double u, double kappa, double theta, double sigma, double rho, double s0, double v0, double rate, double dividend, double T, double K ) : double

Calculates value of the integrand function that appears in the Heston model call price formula.

Phi ( System.Complex u, double kappa, double theta, double sigma, double rho, double s0, double v0, double r, double T ) : System.Complex

Calculates the Heston characteristic function.

The calculation does not follow the original paper by Heston but uses the form found in the paper
Schoutens, W., Simons E. and Tistaert, J. (2004) A perfect calibration! Now what?, Wilmott Magazine, March 2005, 66–78.
As stated in: Albrecher, H., Mayer, Ph., Schoutens, W and Tistaert, J. (2007) The Little Heston Trap. Wilmott Magazine, January Issue, 83-92.
This form does not have the discontinuity issue that affects the form found in the original Heston paper.

PutIntegrandFunc ( double u ) : double

Private Methods

Method Description
HestonCall ( HestonCallOptimizationProblem problem ) : System

Initializes a new instance of the HestonEstimator.HestonCall class.

HestonCall ( HestonCallOptimizationProblem problem, Vector x, double s0 ) : System

Initializes a new instance of the HestonEstimator.HestonCall class.

HestonCallPrice ( ) : double

Calculates the Heston model call price by using local variables.

The indefinite integral present in the formula is performed with extremes [1E-8, 1000]. This choice seems to be sufficient to correctly estimate the indefinite integral.

HestonCallPutPrice ( ) : Vector

Jointly calculate a call and a put price.

HestonPutPrice ( ) : double

Calculates a put price using the Heston model

PerformIntegral ( double a, double b, TAEDelegateFunction1D f ) : double

Numerical integral in R+ assuming the integrand is exponential decaying.

Phi ( double u, double kappa, double theta, double sigma, double rho, double v0, double s0, double r, double T ) : System.Complex

Calculates Heston characteristic function with input u real.

Method Details

HestonCall() public method

Initializes a new instance of the HestonEstimator.HestonCall class.
public HestonCall ( ) : System
return System

HestonCallPrice() public method

Calculates the Heston model call price.
Note that this function is a wrapper for the other one which sets all the variables locally before calling it.
public HestonCallPrice ( Vector x, double s0, double T, double K, double r, double q ) : double
x Vector Vector of Heston model parameters.
s0 double Starting value for the stock process.
T double Maturity of the call option which price is to be calculated.
K double Strike of the call option which price is to be calculated.
r double Risk free rate.
q double Dividend yield.
return double

IntegrandFunc() public method

Calculates value of the integrand function that appears in the Heston model call price formula.
public IntegrandFunc ( double u ) : double
u double Value at which the integrand function is to be calculated.
return double

IntegrandFunc() public method

Calculates value of the integrand function that appears in the Heston model call price formula.
public IntegrandFunc ( double u, double kappa, double theta, double sigma, double rho, double s0, double v0, double rate, double dividend, double T, double K ) : double
u double Value at which the integrand function is to be calculated.
kappa double Heston volatility mean reversion speed parameter.
theta double Heston volatility mean reversion level parameter.
sigma double Heston volatility of volatility parameter.
rho double /// Correlation between the two Wiener processes in the Heston dynamics. ///
s0 double Starting value for the stock process.
v0 double Starting value for the volatility process.
rate double Risk free rate.
dividend double Dividend yield.
T double Maturity of the call option which price is to be calculated.
K double Strike of the call option which price is to be calculated.
return double

Phi() public method

Calculates the Heston characteristic function.
The calculation does not follow the original paper by Heston but uses the form found in the paper
Schoutens, W., Simons E. and Tistaert, J. (2004) A perfect calibration! Now what?, Wilmott Magazine, March 2005, 66–78.
As stated in: Albrecher, H., Mayer, Ph., Schoutens, W and Tistaert, J. (2007) The Little Heston Trap. Wilmott Magazine, January Issue, 83-92.
This form does not have the discontinuity issue that affects the form found in the original Heston paper.
public Phi ( System.Complex u, double kappa, double theta, double sigma, double rho, double s0, double v0, double r, double T ) : System.Complex
u System.Complex /// Complex value at which the characteristic function is to be calculated. ///
kappa double Heston volatility mean reversion speed parameter.
theta double Heston volatility mean reversion level parameter.
sigma double Heston volatility of volatility parameter.
rho double /// Correlation between the two Wiener processes in the Heston dynamics. ///
s0 double Starting value for the stock process.
v0 double Starting value for the volatility process.
r double Risk free rate.
T double Time at which the characteristic function is to be calculated.
return System.Complex

PutIntegrandFunc() public method

public PutIntegrandFunc ( double u ) : double
u double
return double