PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_specfun_opt_heston_greeks (s30nb)
Purpose
nag_specfun_opt_heston_greeks (s30nb) computes the European option price given by Heston's stochastic volatility model together with its sensitivities (Greeks).
Syntax
[
p,
delta,
gamma,
vega,
theta,
rho,
vanna,
charm,
speed,
zomma,
vomma,
ifail] = s30nb(
calput,
x,
s,
t,
sigmav,
kappa,
corr,
var0,
eta,
grisk,
r,
q, 'm',
m, 'n',
n)
[
p,
delta,
gamma,
vega,
theta,
rho,
vanna,
charm,
speed,
zomma,
vomma,
ifail] = nag_specfun_opt_heston_greeks(
calput,
x,
s,
t,
sigmav,
kappa,
corr,
var0,
eta,
grisk,
r,
q, 'm',
m, 'n',
n)
Description
nag_specfun_opt_heston_greeks (s30nb) 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 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:
– double array
-
.
The leading
part of the array
delta contains the sensitivity,
, of the option price to change in the price of the underlying asset.
- 3:
– double array
-
.
The leading
part of the array
gamma contains the sensitivity,
, of
delta to change in the price of the underlying asset.
- 4:
– double array
-
.
, 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 .
- 5:
– double array
-
.
, contains the first-order Greek measuring the sensitivity of the option price to change in time, i.e., , for and , where .
- 6:
– double array
-
.
, 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 .
- 7:
– double array
-
.
, 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 .
- 8:
– double array
-
.
, contains the second-order Greek measuring the sensitivity of the first-order Greek to change in the time, i.e., , for and .
- 9:
– double array
-
.
, 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 .
- 10:
– double array
-
.
, 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 .
- 11:
– double array
-
.
, 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 .
- 12:
– 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 required 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 and sensitivities of a European call using Heston's stochastic volatility model. The time to expiry is
year, 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:
s30nb_example
function s30nb_example
fprintf('s30nb example results\n\n');
calput = 'C';
s = 100.0;
r = 0.025;
q = 0.0;
kappa = 1.5768;
eta = 0.0398;
var0 = 0.0175;
sigmav = 0.5751;
corr = -0.5711;
grisk = 1;
x = [100.0];
t = [1];
[p, delta, gamma, vega, theta, rho, ...
vanna, charm, speed, zomma, vomma, ifail] = ...
s30nb(...
calput, x, s, t, sigmav, kappa, corr, var0, eta, grisk, r, q);
fprintf('\nHeston''s Stochastic Volatility Model\n');
if calput == 'C' || calput == 'c'
fprintf('European Call :\n');
else
fprintf('European Put :\n');
end
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', var0);
fprintf(' Mean of variance = %9.4f\n', eta);
fprintf(' Risk aversion = %9.4f\n', grisk);
fprintf(' Rate = %9.4f\n', r);
fprintf(' Dividend = %9.4f\n\n', q);
for j=1:1
fprintf('%8s%9s%9s%9s%9s%9s%9s\n','Strike','Price','Delta','Gamma',...
'Vega','Theta','Rho');
for i=1:1
fprintf('%8.4f%9.4f%9.4f%9.4f%9.4f%9.4f%9.2f\n', x(i), p(i,j), ...
delta(i,j), gamma(i,j), vega(i,j), theta(i,j), rho(i,j));
end
fprintf('\n%26s%9s%9s%9s%9s\n','Vanna','Charm','Speed','Zomma','Vomma');
for i=1:1
fprintf('%17s%9.4f%9.4f%9.4f%9.4f%9.2f\n', ' ', vanna(i,j), ...
charm(i,j), speed(i,j), zomma(i,j), vomma(i,j));
end
end
s30nb example results
Heston's Stochastic Volatility Model
European Call :
Spot = 100.0000
Volatility of vol = 0.5751
Mean reversion = 1.5768
Correlation = -0.5711
Variance = 0.0175
Mean of variance = 0.0398
Risk aversion = 1.0000
Rate = 0.0250
Dividend = 0.0000
Strike Price Delta Gamma Vega Theta Rho
100.0000 7.2743 0.6945 0.0251 52.5461 -4.9969 62.17
Vanna Charm Speed Zomma Vomma
-0.5643 -0.0321 -0.0023 -0.1976 -321.08
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015