nag_heston_term (s30ncc) (PDF version)
s Chapter Contents
s Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_heston_term (s30ncc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_heston_term (s30ncc) computes the European option price given by Heston's stochastic volatility model with term structure.

2  Specification

#include <nag.h>
#include <nags.h>
void  nag_heston_term (Nag_CallPut option, Integer m, Integer numts, const double x[], double fwd, double disc, const double ts[], double t, const double alpha[], const double lambda[], const double corr[], const double sigmat[], double var0, double p[], NagError *fail)

3  Description

nag_heston_term (s30ncc) 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 1. This leads to
d St St = μt d t+σt νt d Wt1 , (1)
d νt = λt 1-νt d t+ αt νt d Wt2 , (2)
Cov d W t 1 , d W t 2 = ρt d t , (3)
where μt=rt-qt is the drift term representing the contribution of interest rates, rt, and dividends, qt, while σt is the scaling parameter, νt is the scaled variance, λt is the mean reversion rate and αt is the volatility of the scaled volatility, νt. Then, Wti, for i=1,2, are two standard Brownian motions with correlation parameter ρt. Without loss of generality, the drift term, μt, is eliminated by modelling the forward price, Ft, directly, instead of the spot price, St, with
Ft = S0 exp 0 t μs d s . (4)
If required, the spot can be expressed as, S0 = D Ft , where D is the discount factor.
The option price is computed by dividing the time to expiry, T, into ns subintervals t0,t1 , , ti-1,ti , , tns-1,T  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 τ=T-t, the characteristic function solution for the first time subinterval, starting at τ=0, 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, T, the form of the SDE system given by Heston (1993)
d St St = μt d t+ Vt d W t 1 , (5)
d Vt = κ η-Vt d t + σv Vt d W t 2 , (6)
can be recovered by setting V0 = η = σt2 , κ=λt , σv = σt αt .
Conversely, given the Heston form of the SDE pair, to get the term structure form set σ=η , αt = σv / η , λt = κ .

4  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

5  Arguments

1:     optionNag_CallPutInput
On entry: determines whether the option is a call or a put.
option=Nag_Call
A call; the holder has a right to buy.
option=Nag_Put
A put; the holder has a right to sell.
Constraint: option=Nag_Call or Nag_Put.
2:     mIntegerInput
On entry: m, the number of strike prices to be used.
Constraint: m1.
3:     numtsIntegerInput
On entry: ns, the number of subintervals into which the time to expiry, T, is divided.
Constraint: numts1.
4:     x[m]const doubleInput
On entry: x[i-1] contains the ith strike price, for i=1,2,,m.
Constraint: x[i-1]z ​ and ​ x[i-1] 1 / z , where z = nag_real_safe_small_number , the safe range parameter, for i=1,2,,m.
5:     fwddoubleInput
On entry: the forward price of the asset.
Constraint: fwdz and fwd1/z, where z=nag_real_safe_small_number, the safe range parameter.
6:     discdoubleInput
On entry: the discount factor, where the current price of the underlying asset, S0, is given as S0=disc×fwd.
Constraint: discz and disc1/z, where z=nag_real_safe_small_number, the safe range parameter.
7:     ts[numts]const doubleInput
On entry: ts[i-1] 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., Δ ti = ti - ti-1.
Constraint: ts[i-1]z ​ and ​ ts[i-1] 1 / z , where z = nag_real_safe_small_number , the safe range parameter, for i=1,2,,numts.
8:     tdoubleInput
On entry: t contains the time to expiry. If T > Δ ti  then the parameters associated with the last time interval are extended to the expiry time. If T < Δ ti  then the parameters specified are used up until the expiry time. The rest are ignored.
Constraint: tz, where z = nag_real_safe_small_number , the safe range parameter.
9:     alpha[numts]const doubleInput
On entry: alpha[i-1] must contain the value of αt, the value of the volatility of the scaled volatility, ν, over time subinterval Δti.
Constraint: alpha[i-1]z ​ and ​ alpha[i-1] 1 / z , where z = nag_real_safe_small_number , the safe range parameter, for i=1,2,,numts.
10:   lambda[numts]const doubleInput
On entry: lambda[i-1] must contain the value, λt, of the mean reversion parameter over the time subinterval Δ ti.
Constraint: lambda[i-1]z ​ and ​ lambda[i-1] 1 / z , where z = nag_real_safe_small_number , the safe range parameter, for i=1,2,,numts.
11:   corr[numts]const doubleInput
On entry: corr[i-1] must contain the value, ρt, of the correlation parameter over the time subinterval Δ ti.
Constraint: -1.0corr[i-1]1.0, for i=1,2,,numts.
12:   sigmat[numts]const doubleInput
On entry: sigmat[i-1] must contain the value, σt, of the variance scale factor over the time subinterval Δti.
Constraint: sigmat[i-1]z ​ and ​ sigmat[i-1] 1 / z , where z = nag_real_safe_small_number , the safe range parameter, for i=1,2,,numts.
13:   var0doubleInput
On entry: ν0, the initial scaled variance.
Constraint: var00.0.
14:   p[m]doubleOutput
On exit: p[i-1] contains the computed option price at the expiry time, T, corresponding to strike x[i-1] for the specified term structure, for i=1,2,,m.
15:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ACCURACY
Solution cannot be computed accurately. Check values of input arguments.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_CONVERGENCE
Quadrature has not converged to the specified accuracy. However, the result should be a reasonable approximation.
NE_INT
On entry, m=value.
Constraint: m1.
On entry, numts=value.
Constraint: numts1.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
NE_REAL
On entry, disc=value.
Constraint: valuediscvalue.
On entry, fwd=value.
Constraint: valuefwdvalue.
On entry, t=value.
Constraint: tvalue.
On entry, var0=value.
Constraint: var0>0.0.
NE_REAL_ARRAY
On entry, alpha[value]=value.
Constraint: valuealpha[i-1]value.
On entry, corr[value]=value.
Constraint: corr[i-1]1.0.
On entry, lambda[value]=value.
Constraint: valuelambda[i-1]value.
On entry, sigmat[value]=value.
Constraint: valuesigmat[i-1]value.
On entry, ts[value]=value.
Constraint: valuets[i-1]value.
On entry, x[value]=value.
Constraint: valuex[i-1]value.

7  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 10 -8 . 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 10 -10  is used and solutions smaller than this are not accurately evaluated.

8  Parallelism and Performance

nag_heston_term (s30ncc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the Users' Note for your implementation for any additional implementation-specific information.

9  Further Comments

None.

10  Example

This example computes the price of a European call using Heston's stochastic volatility model with a term structure of interest rates.

10.1  Program Text

Program Text (s30ncce.c)

10.2  Program Data

Program Data (s30ncce.d)

10.3  Program Results

Program Results (s30ncce.r)


nag_heston_term (s30ncc) (PDF version)
s Chapter Contents
s Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2014