# NAG Library Function Document

## 1Purpose

nag_jumpdiff_merton_price (s30jac) computes the European option price using the Merton jump-diffusion model.

## 2Specification

 #include #include
 void nag_jumpdiff_merton_price (Nag_OrderType order, Nag_CallPut option, Integer m, Integer n, const double x[], double s, const double t[], double sigma, double r, double lambda, double jvol, double p[], NagError *fail)

## 3Description

nag_jumpdiff_merton_price (s30jac) uses Merton's jump-diffusion model (Merton (1976)) to compute the price of a European option. This assumes that the asset price is described by a Brownian motion with drift, as in the Black–Scholes–Merton case, together with a compound Poisson process to model the jumps. The corresponding stochastic differential equation is,
 $dS S = α-λk dt + σ^ dWt + dqt .$
Here $\alpha$ is the instantaneous expected return on the asset price, $S$; ${\stackrel{^}{\sigma }}^{2}$ is the instantaneous variance of the return when the Poisson event does not occur; ${dW}_{t}$ is a standard Brownian motion; ${q}_{t}$ is the independent Poisson process and $k=E\left[Y-1\right]$ where $Y-1$ is the random variable change in the stock price if the Poisson event occurs and $E$ is the expectation operator over the random variable $Y$.
This leads to the following price for a European option (see Haug (2007))
 $Pcall = ∑ j=0 ∞ e-λT λTj j! Cj S, X, T, r, σj′ ,$
where $T$ is the time to expiry; $X$ is the strike price; $r$ is the annual risk-free interest rate; ${C}_{j}\left(S,X,T,r,{\sigma }_{j}^{\prime }\right)$ is the Black–Scholes–Merton option pricing formula for a European call (see nag_bsm_price (s30aac)).
 $σj′ = z2 + δ2 j T , z2 = σ2 - λ δ2 , δ2 = γ σ2 λ ,$
where $\sigma$ is the total volatility including jumps; $\lambda$ is the expected number of jumps given as an average per year; $\gamma$ is the proportion of the total volatility due to jumps.
The value of a put is obtained by substituting the Black–Scholes–Merton put price for ${C}_{j}\left(S,X,T,r,{\sigma }_{j}^{\prime }\right)$.
The option price ${P}_{ij}=P\left(X={X}_{i},T={T}_{j}\right)$ is computed for each strike price in a set ${X}_{i}$, $i=1,2,\dots ,m$, and for each expiry time in a set ${T}_{j}$, $j=1,2,\dots ,n$.

## 4References

Haug E G (2007) The Complete Guide to Option Pricing Formulas (2nd Edition) McGraw-Hill
Merton R C (1976) Option pricing when underlying stock returns are discontinuous Journal of Financial Economics 3 125–144

## 5Arguments

1:    $\mathbf{order}$Nag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.3.1.3 in How to Use the NAG Library and its Documentation for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2:    $\mathbf{option}$Nag_CallPutInput
On entry: determines whether the option is a call or a put.
${\mathbf{option}}=\mathrm{Nag_Call}$
A call; the holder has a right to buy.
${\mathbf{option}}=\mathrm{Nag_Put}$
A put; the holder has a right to sell.
Constraint: ${\mathbf{option}}=\mathrm{Nag_Call}$ or $\mathrm{Nag_Put}$.
3:    $\mathbf{m}$IntegerInput
On entry: the number of strike prices to be used.
Constraint: ${\mathbf{m}}\ge 1$.
4:    $\mathbf{n}$IntegerInput
On entry: the number of times to expiry to be used.
Constraint: ${\mathbf{n}}\ge 1$.
5:    $\mathbf{x}\left[{\mathbf{m}}\right]$const doubleInput
On entry: ${\mathbf{x}}\left[i-1\right]$ must contain ${X}_{\mathit{i}}$, the $\mathit{i}$th strike price, for $\mathit{i}=1,2,\dots ,{\mathbf{m}}$.
Constraint: ${\mathbf{x}}\left[\mathit{i}-1\right]\ge z\text{​ and ​}{\mathbf{x}}\left[\mathit{i}-1\right]\le 1/z$, where $z={\mathbf{nag_real_safe_small_number}}$, the safe range parameter, for $\mathit{i}=1,2,\dots ,{\mathbf{m}}$.
6:    $\mathbf{s}$doubleInput
On entry: $S$, the price of the underlying asset.
Constraint: ${\mathbf{s}}\ge z\text{​ and ​}{\mathbf{s}}\le 1.0/z$, where $z={\mathbf{nag_real_safe_small_number}}$, the safe range parameter.
7:    $\mathbf{t}\left[{\mathbf{n}}\right]$const doubleInput
On entry: ${\mathbf{t}}\left[i-1\right]$ must contain ${T}_{\mathit{i}}$, the $\mathit{i}$th time, in years, to expiry, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
Constraint: ${\mathbf{t}}\left[\mathit{i}-1\right]\ge z$, where $z={\mathbf{nag_real_safe_small_number}}$, the safe range parameter, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
8:    $\mathbf{sigma}$doubleInput
On entry: $\sigma$, the annual total volatility, including jumps.
Constraint: ${\mathbf{sigma}}>0.0$.
9:    $\mathbf{r}$doubleInput
On entry: $r$, the annual risk-free interest rate, continuously compounded. Note that a rate of 5% should be entered as 0.05.
Constraint: ${\mathbf{r}}\ge 0.0$.
10:  $\mathbf{lambda}$doubleInput
On entry: $\lambda$, the number of expected jumps per year.
Constraint: ${\mathbf{lambda}}>0.0$.
11:  $\mathbf{jvol}$doubleInput
On entry: the proportion of the total volatility associated with jumps.
Constraint: $0.0\le {\mathbf{jvol}}<1.0$.
12:  $\mathbf{p}\left[{\mathbf{m}}×{\mathbf{n}}\right]$doubleOutput
Note: where ${\mathbf{P}}\left(i,j\right)$ appears in this document, it refers to the array element
• ${\mathbf{p}}\left[\left(j-1\right)×{\mathbf{m}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{p}}\left[\left(i-1\right)×{\mathbf{n}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: ${\mathbf{P}}\left(i,j\right)$ contains ${P}_{ij}$, the option price evaluated for the strike price ${{\mathbf{x}}}_{i}$ at expiry ${{\mathbf{t}}}_{j}$ for $i=1,2,\dots ,{\mathbf{m}}$ and $j=1,2,\dots ,{\mathbf{n}}$.
13:  $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{m}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{m}}\ge 1$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 1$.
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.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_REAL
On entry, ${\mathbf{jvol}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{jvol}}\ge 0.0$ and ${\mathbf{jvol}}<1.0$.
On entry, ${\mathbf{lambda}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{lambda}}>0.0$.
On entry, ${\mathbf{r}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{r}}\ge 0.0$.
On entry, ${\mathbf{s}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{s}}\ge 〈\mathit{\text{value}}〉$ and ${\mathbf{s}}\le 〈\mathit{\text{value}}〉$.
On entry, ${\mathbf{sigma}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{sigma}}>0.0$.
NE_REAL_ARRAY
On entry, ${\mathbf{t}}\left[〈\mathit{\text{value}}〉\right]=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{t}}\left[i\right]\ge 〈\mathit{\text{value}}〉$.
On entry, ${\mathbf{x}}\left[〈\mathit{\text{value}}〉\right]=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{x}}\left[i\right]\ge 〈\mathit{\text{value}}〉$ and ${\mathbf{x}}\left[i\right]\le 〈\mathit{\text{value}}〉$.

## 7Accuracy

The accuracy of the output is dependent on the accuracy of the cumulative Normal distribution function, $\Phi$, occurring in ${C}_{j}$. This is evaluated using a rational Chebyshev expansion, chosen so that the maximum relative error in the expansion is of the order of the machine precision (see nag_cumul_normal (s15abc) and nag_erfc (s15adc)). An accuracy close to machine precision can generally be expected.

## 8Parallelism and Performance

nag_jumpdiff_merton_price (s30jac) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_jumpdiff_merton_price (s30jac) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

None.

## 10Example

This example computes the price of a European call with jumps. The time to expiry is $3$ months, the stock price is $45$ and the strike price is $55$. The number of jumps per year is $3$ and the percentage of the total volatility due to jumps is $40%$. The risk-free interest rate is $10%$ per year and the total volatility is $25%$ per year.

### 10.1Program Text

Program Text (s30jace.c)

### 10.2Program Data

Program Data (s30jace.d)

### 10.3Program Results

Program Results (s30jace.r)

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