PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_specfun_opt_heston_price (s30na)
Purpose
nag_specfun_opt_heston_price (s30na) computes the European option price given by Heston's stochastic volatility model.
Syntax
[
p,
ifail] = s30na(
calput,
x,
s,
t,
sigmav,
kappa,
corr,
var0,
eta,
grisk,
r,
q, 'm',
m, 'n',
n)
[
p,
ifail] = nag_specfun_opt_heston_price(
calput,
x,
s,
t,
sigmav,
kappa,
corr,
var0,
eta,
grisk,
r,
q, 'm',
m, 'n',
n)
Description
nag_specfun_opt_heston_price (s30na) 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 http://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
Parameters
Compulsory Input Parameters
- 1:
– string (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.
Constraint:
or .
- 2:
– double array
-
must contain
, the th strike price, for .
Constraint:
, where , the safe range parameter, for .
- 3:
– double scalar
-
, the price of the underlying asset.
Constraint:
, where , the safe range parameter.
- 4:
– double array
-
must contain
, the th time, in years, to expiry, for .
Constraint:
, where , the safe range parameter, for .
- 5:
– double scalar
-
The volatility, , of the volatility process, . Note that a rate of 20% should be entered as .
Constraint:
.
- 6:
– double scalar
-
, the long term mean reversion rate of the volatility.
Constraint:
.
- 7:
– double scalar
-
The correlation between the two standard Brownian motions for the asset price and the volatility.
Constraint:
.
- 8:
– double scalar
-
The initial value of the variance, , of the asset price.
Constraint:
.
- 9:
– double scalar
-
, the long term mean of the variance of the asset price.
Constraint:
.
- 10:
– double scalar
-
The risk aversion parameter, , of the representative agent.
Constraint:
and .
- 11:
– double scalar
-
, the annual risk-free interest rate, continuously compounded. Note that a rate of 5% should be entered as 0.05.
Constraint:
.
- 12:
– double scalar
-
, the annual continuous yield rate. Note that a rate of 8% should be entered as 0.08.
Constraint:
.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the array
x.
The number of strike prices to be used.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the dimension of the array
t.
The number of times to expiry to be used.
Constraint:
.
Output Parameters
- 1:
– double array
-
.
contains , the option price evaluated for the strike price at expiry for and .
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
On entry, was an illegal value.
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: and .
-
-
Constraint: and .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: and .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
- W
-
Quadrature has not converged to the specified accuracy. However, the result should be a reasonable approximation.
- W
-
Solution cannot be computed accurately. Check values of input arguments.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
The accuracy of the output is determined by the accuracy of the numerical quadrature used to evaluate the integral in
(1). An adaptive method is used which evaluates the integral to within a tolerance of
, where
is the absolute value of the integral.
Further Comments
None.
Example
This example computes the price of a European call using Heston's stochastic volatility model. The time to expiry is
months, the stock price is
and the strike price is
. The risk-free interest rate is
per year, the volatility of the variance,
, is
per year, the mean reversion parameter,
, is
, the long term mean of the variance,
, is
and the correlation between the volatility process and the stock price process,
, is
. The risk aversion parameter,
, is
and the initial value of the variance,
var0, is
.
Open in the MATLAB editor:
s30na_example
function s30na_example
fprintf('s30na example results\n\n');
put = 'C';
s = 100.0;
r = 0.05;
q = 0.0;
gamma=1.0;
kappa = 2.0;
eta = 0.01;
var0 = 0.01;
sigmav = 0.225;
corr = 0.0;
x = [100.0];
t = [0.5];
[p, ifail] = s30na( ...
put, x, s, t, sigmav, kappa, corr, var0, eta, gamma, r, q);
fprintf('\nHeston''s Stochastic Volatility Model\n European Call :\n');
fprintf(' Spot = %9.4f\n', s);
fprintf(' Volatility of vol = %9.4f\n', sigmav);
fprintf(' Mean reversion = %9.4f\n', kappa);
fprintf(' Correlation = %9.4f\n', corr);
fprintf(' Variance = %9.4f\n', eta);
fprintf(' Mean of variance = %9.4f\n', var0);
fprintf(' Risk aversion = %9.4f\n', gamma);
fprintf(' Rate = %9.4f\n', r);
fprintf(' Dividend = %9.4f\n\n', 1);
fprintf(' Strike Expiry Option Price\n');
for i=1:1
for j=1:1
fprintf('%9.4f %9.4f %9.4f\n', x(i), t(j), p(i,j));
end
end
s30na example results
Heston's Stochastic Volatility Model
European Call :
Spot = 100.0000
Volatility of vol = 0.2250
Mean reversion = 2.0000
Correlation = 0.0000
Variance = 0.0100
Mean of variance = 0.0100
Risk aversion = 1.0000
Rate = 0.0500
Dividend = 1.0000
Strike Expiry Option Price
100.0000 0.5000 4.0851
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015