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

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

opt_heston_greeks computes the European option price given by Heston’s stochastic volatility model together with its sensitivities (Greeks).

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

https://www.nag.com/numeric/nl/nagdoc_29/flhtml/s/s30nbf.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 .

deltafloat, ndarray, shape

The leading part of the array contains the sensitivity, , of the option price to change in the price of the underlying asset.

gammafloat, ndarray, shape

The leading part of the array contains the sensitivity, , of to change in the price of the underlying asset.

vegafloat, ndarray, shape

, contains the first-order Greek measuring the sensitivity of the option price to change in the volatility of the underlying asset, i.e., , for and .

thetafloat, ndarray, shape

, contains the first-order Greek measuring the sensitivity of the option price to change in time, i.e., , for and , where .

rhofloat, ndarray, shape

, contains the first-order Greek measuring the sensitivity of the option price to change in the annual risk-free interest rate, i.e., , for and .

vannafloat, ndarray, shape

, contains the second-order Greek measuring the sensitivity of the first-order Greek to change in the volatility of the asset price, i.e., , for and .

charmfloat, ndarray, shape

, contains the second-order Greek measuring the sensitivity of the first-order Greek to change in the time, i.e., , for and .

speedfloat, ndarray, shape

, contains the third-order Greek measuring the sensitivity of the second-order Greek to change in the price of the underlying asset, i.e., , for and .

zommafloat, ndarray, shape

, contains the third-order Greek measuring the sensitivity of the second-order Greek to change in the volatility of the underlying asset, i.e., , for and .

vommafloat, ndarray, shape

, contains the second-order Greek measuring the sensitivity of the first-order Greek to change in the volatility of the underlying asset, i.e., , 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 required accuracy. However, the result should be a reasonable approximation.

(errno )

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

Notes

opt_heston_greeks computes the price and sensitivities 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.

Writing the expression for the price of a call option as

then the sensitivities or Greeks can be obtained in the following manner,

Delta

Vega

Rho

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