PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_specfun_opt_heston_term (s30nc)
Purpose
nag_specfun_opt_heston_term (s30nc) computes the European option price given by Heston's stochastic volatility model with term structure.
Syntax
[
p,
ifail] = s30nc(
calput,
x,
fwd,
disc,
ts,
t,
alpha,
lambda,
corr,
sigmat,
var0, 'm',
m, 'numts',
numts)
[
p,
ifail] = nag_specfun_opt_heston_term(
calput,
x,
fwd,
disc,
ts,
t,
alpha,
lambda,
corr,
sigmat,
var0, 'm',
m, 'numts',
numts)
Description
nag_specfun_opt_heston_term (s30nc) computes the price of a European option for Heston's stochastic volatility model with time-dependent parameters which are piecewise constant. Starting from the stochastic volatility model given by the Stochastic Differential Equation (SDE) system defined by
Heston (1993), a scaling of the variance process is introduced, together with a normalization, setting the long run variance,
, equal to
. This leads to
where
is the drift term representing the contribution of interest rates,
, and dividends,
, while
is the scaling parameter,
is the scaled variance,
is the mean reversion rate and
is the volatility of the scaled volatility,
. Then,
, for
, are two standard Brownian motions with correlation parameter
. Without loss of generality, the drift term,
, is eliminated by modelling the forward price,
, directly, instead of the spot price,
, with
If required, the spot can be expressed as,
, where
is the discount factor.
The option price is computed by dividing the time to expiry,
, into
subintervals
and applying the method of characteristic functions to each subinterval, with appropriate initial conditions. Thus, a pair of ordinary differential equations (one of which is a Riccati equation) is solved on each subinterval as outlined in
Elices (2008) and
Mikhailov and Nögel (2003). Reversing time by taking
, the characteristic function solution for the first time subinterval, starting at
, is given by
Heston (1993), while the solution on each following subinterval uses the solution of the preceding subinterval as initial condition to compute the value of the characteristic function.
In the case of a ‘flat’ term structure, i.e., the parameters are constant over the time of the option,
, the form of the SDE system given by
Heston (1993)
can be recovered by setting
,
,
.
Conversely, given the Heston form of the SDE pair, to get the term structure form set , , .
References
Bain A (2011) Private communication
Elices A (2008) Models with time-dependent parameters using transform methods: application to Heston’s model arXiv:0708.2020v2
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
Mikhailov S and Nögel U (2003) Heston’s Stochastic Volatility Model Implementation, Calibration and Some Extensions Wilmott Magazine July/August 74–79
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
-
contains the
th strike price, for .
Constraint:
, where , the safe range parameter, for .
- 3:
– double scalar
-
The forward price of the asset.
Constraint:
and , where , the safe range parameter.
- 4:
– double scalar
-
The discount factor, where the current price of the underlying asset, , is given as .
Constraint:
and , where , the safe range parameter.
- 5:
– double array
-
must contain the length of the time intervals for which the corresponding element of
alpha,
lambda,
corr and
sigmat apply. These should be ordered as they occur in time i.e.,
.
Constraint:
, where , the safe range parameter, for .
- 6:
– double scalar
-
t contains the time to expiry. If
then the parameters associated with the last time interval are extended to the expiry time. If
then the parameters specified are used up until the expiry time. The rest are ignored.
Constraint:
, where , the safe range parameter.
- 7:
– double array
-
must contain the value of , the value of the volatility of the scaled volatility, , over time subinterval .
Constraint:
, where , the safe range parameter, for .
- 8:
– double array
-
must contain the value, , of the mean reversion parameter over the time subinterval .
Constraint:
, where , the safe range parameter, for .
- 9:
– double array
-
must contain the value, , of the correlation parameter over the time subinterval .
Constraint:
, for .
- 10:
– double array
-
must contain the value, , of the variance scale factor over the time subinterval .
Constraint:
, where , the safe range parameter, for .
- 11:
– double scalar
-
, the initial scaled variance.
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 arrays
corr,
lambda,
sigmat,
ts,
alpha. (An error is raised if these dimensions are not equal.)
, the number of subintervals into which the time to expiry, , is divided.
Constraint:
.
Output Parameters
- 1:
– double array
-
contains the computed option price at the expiry time, , corresponding to strike for the specified term structure, for .
- 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:
-
-
On entry, was an illegal value.
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Quadrature has not converged to the specified accuracy. However, the result should be a reasonable approximation.
-
-
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 solution is obtained by integrating the pair of ordinary differential equations over each subinterval in time. The accuracy is controlled by a relative tolerance over each time subinterval, which is set to . Over a number of subintervals in time the error may accumulate and so the overall error in the computation may be greater than this. A threshold of is used and solutions smaller than this are not accurately evaluated.
Further Comments
None.
Example
This example computes the price of a European call using Heston's stochastic volatility model with a term structure of interest rates.
Open in the MATLAB editor:
s30nc_example
function s30nc_example
fprintf('s30nc example results\n\n');
calput = 'C';
fwd = 100;
disc = 1;
var0 = 1;
fprintf('European Call :\n');
fprintf(' %-22s = %9.4f\n','Forward',fwd);
fprintf(' %-22s = %9.4f\n','Discount factor',disc);
fprintf(' %-22s = %9.4f\n','Variance',var0);
m = 1;
x = [100];
n = 2;
ts = [ 0.35 0.65];
t = 1;
alpha = [ 2.25 1.5];
corr = [-0.05 0.1];
lambda = [ 2.0 1.5];
sigmat = [ 0.04 0.13];
fprintf('\n%6s%13s%11s%8s%12s\n','ts','alpha','lambda','corr','sigmat');
for i = 1:n
fprintf('%10.4f%10.4f%10.4f%10.4f%10.4f\n',...
ts(i),alpha(i),lambda(i),corr(i),sigmat(i));
end
[p, ifail] = s30nc(...
calput, x, fwd, disc, ts, t, ...
alpha, lambda, corr, sigmat, var0);
fprintf('\n%10s%10s%10s\n','strike','expiry','price');
for i = 1:m
fprintf('%10.4f%10.4f%10.4f\n',x(i),t,p(i));
end
s30nc example results
European Call :
Forward = 100.0000
Discount factor = 1.0000
Variance = 1.0000
ts alpha lambda corr sigmat
0.3500 2.2500 2.0000 -0.0500 0.0400
0.6500 1.5000 1.5000 0.1000 0.1300
strike expiry price
100.0000 1.0000 4.0074
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015