# naginterfaces.library.specfun.opt_​heston_​price¶

naginterfaces.library.specfun.opt_heston_price(calput, x, s, t, sigmav, kappa, corr, var0, eta, grisk, r, q)[source]

opt_heston_price computes the European option price given by Heston’s stochastic volatility model.

For full information please refer to the NAG Library document for s30na

https://www.nag.com/numeric/nl/nagdoc_29.3/flhtml/s/s30naf.html

Parameters
calputstr, length 1

Determines whether the option is a call or a put.

A call; the holder has a right to buy.

A put; the holder has a right to sell.

xfloat, array-like, shape

must contain , the th strike price, for .

sfloat

, the price of the underlying asset.

tfloat, array-like, shape

must contain , the th time, in years, to expiry, for .

sigmavfloat

The volatility, , of the volatility process, . Note that a rate of 20% should be entered as .

kappafloat

, the long term mean reversion rate of the volatility.

corrfloat

The correlation between the two standard Brownian motions for the asset price and the volatility.

var0float

The initial value of the variance, , of the asset price.

etafloat

, the long term mean of the variance of the asset price.

griskfloat

The risk aversion parameter, , of the representative agent.

rfloat

, the annual risk-free interest rate, continuously compounded. Note that a rate of 5% should be entered as .

qfloat

, the annual continuous yield rate. Note that a rate of 8% should be entered as .

Returns
pfloat, ndarray, shape

contains , the option price evaluated for the strike price at expiry for and .

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: and .

(errno )

On entry, .

Constraint: and .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, , and .

Constraint: and .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

Quadrature has not converged to the specified accuracy. However, the result should be a reasonable approximation.

(errno )

Solution cannot be computed accurately. Check values of input arguments.

Notes

opt_heston_price computes the price of a European option using Heston’s stochastic volatility model. The return on the asset price, , is

and the instantaneous variance, , is defined by a mean-reverting square root stochastic process,

where is the risk free annual interest rate; is the annual dividend rate; is the variance of the asset price; is the volatility of the volatility, ; is the mean reversion rate; is the long term variance. , for , denotes two correlated standard Brownian motions with

The option price is computed by evaluating the integral transform given by Lewis (2000) using the form of the characteristic function discussed by Albrecher et al. (2007), see also Kilin (2006).

where and

with . Here is the risk aversion parameter of the representative agent with and . The value corresponds to , where is the market price of risk in Heston (1993) (see Lewis (2000) and Rouah and Vainberg (2007)).

The price of a put option is obtained by put-call parity.

The option price is computed for each strike price in a set , , and for each expiry time in a set , .

References

Albrecher, H, Mayer, P, Schoutens, W and Tistaert, J, 2007, The little Heston trap, Wilmott Magazine (January 2007), 83–92

Heston, S, 1993, A closed-form solution for options with stochastic volatility with applications to bond and currency options, Review of Financial Studies (6), 327–343

Kilin, F, 2006, Accelerating the calibration of stochastic volatility models, MPRA Paper No. 2975, https://mpra.ub.uni-muenchen.de/2975/

Lewis, A L, 2000, Option valuation under stochastic volatility, Finance Press, USA

Rouah, F D and Vainberg, G, 2007, Option Pricing Models and Volatility using Excel-VBA, John Wiley and Sons, Inc