# optSensByBatesFD

Option price and sensitivities by Bates model using finite differences

## Syntax

## Description

`[`

computes a vanilla European or American option price and sensitivities by the Bates model,
using the alternating direction implicit (ADI) method.`PriceSens`

,`PriceGrid`

,`AssetPrices`

,`Variances`

,`Times`

] = optSensByBatesFD(`Rate`

,`AssetPrice`

,`Settle`

,`ExerciseDates`

,`OptSpec`

,`Strike`

,`V0`

,`ThetaV`

,`Kappa`

,`SigmaV`

,`RhoSV`

,`MeanJ`

,`JumpVol`

,`JumpFreq`

)

**Note**

Alternatively, you can use the `Vanilla`

object to calculate
price or sensitivities for vanilla options. For more information, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

`[`

specifies options using one or more name-value pair arguments in addition to the input
arguments in the previous syntax. `PriceSens`

,`PriceGrid`

,`AssetPrices`

,`Variances`

,`Times`

] = optSensByBatesFD(___,`Name,Value`

)

## Examples

### Compute Price and Sensitivities for an American Option Using the Bates Model

Define the option variables and Bates model parameters.

AssetPrice = 90; Strike = 100; Rate = 0.03; Settle = datetime(2018,1,1); ExerciseDates = datetime(2018,6,2); V0 = 0.04; ThetaV = 0.04; Kappa = 2; SigmaV = 0.25; RhoSV = -0.5; JumpVol = 0.4; MeanJ = exp(-0.5+JumpVol.^2/2)-1; JumpFreq = 0.2;

Compute the American put option price and sensitivities using the finite differences method.

OptSpec = 'Put'; [Price, Delta, Gamma, Rho, Theta, Vega, VegaLT] = optSensByBatesFD(Rate, AssetPrice, Settle, ExerciseDates,... OptSpec, Strike, V0, ThetaV, Kappa, SigmaV, RhoSV, MeanJ, JumpVol, JumpFreq, 'AmericanOpt', 1,... 'OutSpec', ["Price" "Delta" "Gamma" "Rho" "Theta" "Vega" "VegaLT"])

Price = 11.2164

Delta = -0.6988

Gamma = 0.0391

Rho = -17.1376

Theta = -4.7656

Vega = 13.3283

VegaLT = 6.1456

## Input Arguments

`Rate`

— Continuously compounded risk-free interest rate

scalar decimal

Continuously compounded risk-free interest rate, specified as a scalar decimal.

**Data Types: **`double`

`AssetPrice`

— Current underlying asset price

scalar numeric

Current underlying asset price, specified as a scalar numeric.

**Data Types: **`double`

`Settle`

— Option settlement date

datetime scalar | string scalar | date character vector

Option settlement date, specified as a scalar datetime, string, or data character vector.

To support existing code, `optSensByBatesFD`

also
accepts serial date numbers as inputs, but they are not recommended.

`ExerciseDates`

— Option exercise dates

datetime array | string array | date character vector

Option exercise dates, specified as a datetime array, string array, or date character vectors:

For a European option, use a scalar date. For a European option,

`ExerciseDates`

contains only one value: the option expiry date.For an American option, use a

`1`

-by-`2`

vector of dates to specify the exercise date boundaries. An American option can be exercised on any date between or including the pair of dates. If only one non-`NaN`

date is listed, then the option can be exercised between`Settle`

date and the single listed value in`ExerciseDates`

.

To support existing code, `optSensByBatesFD`

also
accepts serial date numbers as inputs, but they are not recommended.

`OptSpec`

— Definition of option

character vector with value of `'call'`

or
`'put'`

| string with value of `"call"`

or `"put"`

Definition of the option, specified as a scalar using a character vector or string
with a value of `'call'`

or `'put'`

.

**Data Types: **`cell`

| `string`

`Strike`

— Option strike price value

numeric

Option strike price value, specified as a scalar numeric.

**Data Types: **`double`

`V0`

— Initial variance of underlying asset

scalar numeric

Initial variance of the underling asset, specified as a scalar numeric.

**Data Types: **`double`

`ThetaV`

— Long-term variance of underlying asset

scalar numeric

Long-term variance of the underling asset, specified as a scalar numeric.

**Data Types: **`double`

`Kappa`

— Mean revision speed for the variance of underlying asset

scalar numeric

Mean revision speed for the underlying asset, specified as a scalar numeric.

**Data Types: **`double`

`SigmaV`

— Volatility of the variance of underlying asset

scalar numeric

Volatility of the variance of the underling asset, specified as a scalar numeric.

**Data Types: **`double`

`RhoSV`

— Correlation between Weiner processes for underlying asset and its variance

scalar numeric

Correlation between the Weiner processes for the underlying asset and its variance, specified as a scalar numeric.

**Data Types: **`double`

`MeanJ`

— Mean of random percentage jump size

scalar decimal

Mean of the random percentage jump size (*J*), specified as a
scalar decimal where `log`

(1+*J*) is normally
distributed with the mean
(`log`

(1+`MeanJ`

)-0.5*`JumpVol`

^2)
and the standard deviation `JumpVol`

.

**Data Types: **`double`

`JumpVol`

— Standard deviation of `log`

(1+*J*)

scalar decimal

Standard deviation of `log`

(1+*J*) where
`J`

is the random percentage jump size, specified as a scalar
decimal.

**Data Types: **`double`

`JumpFreq`

— Annual frequency of Poisson jump process

scalar numeric

Annual frequency of the Poisson jump process, specified as a scalar numeric.

**Data Types: **`double`

### Name-Value Arguments

Specify optional pairs of arguments as
`Name1=Value1,...,NameN=ValueN`

, where `Name`

is
the argument name and `Value`

is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.

*
Before R2021a, use commas to separate each name and value, and enclose*
`Name`

*in quotes.*

**Example: **```
[PriceSens,PriceGrid] =
optSensByBatesFD(Rate,AssetPrice,Settle,ExerciseDates,OptSpec,Strike,V0,ThetaV,Kappa,SigmaV,RhoSV,MeanJ,JumpVol,JumpFreq,'Basis',7,'OutSpec','delta')
```

`Basis`

— Day-count basis of instrument

`0`

(default) | numeric values: `0`

,`1`

, `2`

,
`3`

, `4`

, `6`

,
`7`

, `8`

, `9`

,
`10`

, `11`

, `12`

,
`13`

Day-count basis of the instrument, specified as the comma-separated pair
consisting of `'Basis'`

and a scalar using a supported value:

0 = actual/actual

1 = 30/360 (SIA)

2 = actual/360

3 = actual/365

4 = 30/360 (PSA)

5 = 30/360 (ISDA)

6 = 30/360 (European)

7 = actual/365 (Japanese)

8 = actual/actual (ICMA)

9 = actual/360 (ICMA)

10 = actual/365 (ICMA)

11 = 30/360E (ICMA)

12 = actual/365 (ISDA)

13 = BUS/252

For more information, see Basis.

**Data Types: **`double`

`DividendYield`

— Continuously compounded underlying asset yield

`0`

(default) | scalar numeric

Continuously compounded underlying asset yield, specified as the comma-separated
pair consisting of `'DividendYield'`

and a scalar numeric.

**Note**

If you enter a value for `DividendYield`

, then set
`DividendAmounts`

and `ExDividendDates`

=
`[ ]`

or do not enter them. If you enter values for
`DividendAmounts`

and `ExDividendDates`

,
then set `DividendYield`

= `0`

.

**Data Types: **`double`

`DividendAmounts`

— Cash dividend amounts

`[ ]`

(default) | vector

Cash dividend amounts, specified as the comma-separated pair consisting of
`'DividendAmounts'`

and an
`NDIV`

-by-`1`

vector.

**Note**

Each dividend amount must have a corresponding ex-dividend date. If you enter
values for `DividendAmounts`

and
`ExDividendDates`

, then set
`DividendYield`

= `0`

.

**Data Types: **`double`

`ExDividendDates`

— Ex-dividend dates

`[ ]`

(default) | datetime array | string array | date character vector

Ex-dividend dates, specified as the comma-separated pair consisting of
`'ExDividendDates'`

and an
`NDIV`

-by-`1`

vector using a datetime array,
string array, or date character vectors.

To support existing code, `optSensByBatesFD`

also
accepts serial date numbers as inputs, but they are not recommended.

`AssetPriceMax`

— Maximum price for price grid boundary

if unspecified, value is calculated based on asset price
distribution at maturity (default) | positive scalar numeric

Maximum price for the price grid boundary, specified as the comma-separated pair
consisting of `'AssetPriceMax'`

and a positive scalar numeric.

**Data Types: **`double`

`VarianceMax`

— Maximum variance for variance grid boundary

`1.0`

(default) | scalar numeric

Maximum variance for the variance grid boundary, specified as the comma-separated
pair consisting of `'VarianceMax'`

as a scalar numeric.

**Data Types: **`double`

`AssetGridSize`

— Size of asset grid for finite difference grid

`400`

(default) | scalar numeric

Size of the asset grid for finite difference grid, specified as the
comma-separated pair consisting of `'AssetGridSize'`

and a scalar
numeric.

**Data Types: **`double`

`VarianceGridSize`

— Number of nodes of variance grid for finite difference grid

`200`

(default) | scalar numeric

Number of nodes of the variance grid for the finite difference grid, specified as
the comma-separated pair consisting of `'VarianceGridSize'`

and a
scalar numeric.

**Data Types: **`double`

`TimeGridSize`

— Number of nodes of time grid for finite difference grid

`100`

(default) | positive numeric scalar

Number of nodes of the time grid for the finite difference grid, specified as the
comma-separated pair consisting of `'TimeGridSize'`

and a positive
numeric scalar.

**Data Types: **`double`

`AmericanOpt`

— Option type

`0`

(European) (default) | scalar with value of `[0,1]`

Option type, specified as the comma-separated pair consisting of
`'AmericanOpt'`

and a scalar flag with one of these values:

`0`

— European`1`

— American

**Data Types: **`double`

`OutSpec`

— Define outputs

`['price']`

(default) | cell array of character vectors with values `'price'`

,
`'delta'`

, `'gamma'`

, `'vega'`

,
`'rho'`

, `'theta'`

, and
`'vegalt'`

| string array with values `"price"`

, `"delta"`

,
`"gamma"`

, `"vega"`

, `"rho"`

,
`"theta"`

, and `"vegalt"`

Define outputs, specified as the comma-separated pair consisting of
`'OutSpec'`

and a `NOUT`

- by-`1`

or a `1`

-by-`NOUT`

string array or cell array of
character vectors with supported values.

**Note**

`'vega'`

is the sensitivity with respect to the initial
volatility sqrt(`V0`

). In contrast, `'vegalt'`

is the sensitivity with respect to the long-term volatility
sqrt(`ThetaV`

).

**Example: **```
OutSpec =
['price','delta','gamma','vega','rho','theta','vegalt']
```

**Data Types: **`string`

| `cell`

## Output Arguments

`PriceSens`

— Option price or sensitivities

numeric

Option price or sensitivities, returned as a numeric. The name-value pair argument
`OutSpec`

determines the types and order of the outputs.

`PriceGrid`

— Grid containing prices calculated by the finite difference method

grid

Grid containing prices calculated by the finite difference method, returned as a
two-dimensional grid with size `AssetGridSize`

⨉
`TimeGridSize`

. The number of columns is not necessarily equal to
the `TimeGridSize`

because the function adds exercise and ex-dividend
dates to the time grid. `PriceGrid(:, :, end)`

contains the price for
*t* = `0`

.

`AssetPrices`

— Prices of the asset

vector

Prices of the asset corresponding to the first dimension of
`PriceGrid`

, returned as a vector.

`Variances`

— Variances

vector

Variances corresponding to the second dimension of `PriceGrid`

,
returned as a vector.

`Times`

— Times

vector

Times corresponding to the third dimension of `PriceGrid`

,
returned as a vector.

## More About

### Vanilla Option

A *vanilla option* is a category of options that
includes only the most standard components.

A vanilla option has an expiration date and straightforward strike price. American-style options and European-style options are both categorized as vanilla options.

The payoff for a vanilla option is as follows:

For a call: $$\mathrm{max}(St-K,0)$$

For a put: $$\mathrm{max}(K-St,0)$$

where:

*St* is the price of the underlying asset at time
*t*.

*K* is the strike price.

For more information, see Vanilla Option.

### Bates Stochastic Volatility Jump Diffusion Model

The Bates model [1] extends the Heston model by including stochastic volatility and (similar to Merton) jump diffusion parameters in the modeling of sudden asset price movements.

The stochastic differential equation is

$$\begin{array}{l}d{S}_{t}=(r-q-{\lambda}_{p}{\mu}_{J}){S}_{t}dt+\sqrt{{v}_{t}}{S}_{t}d{W}_{t}+J{S}_{t}d{P}_{t}\\ d{v}_{t}=\kappa (\theta -{v}_{t})dt+{\sigma}_{v}\sqrt{{v}_{t}}d{W}_{t}\\ \text{E}\left[d{W}_{t}d{W}_{t}^{v}\right]=pdt\\ \text{prob(}d{P}_{t}=1)={\lambda}_{p}dt\end{array}$$

where:

*r* is the continuous risk-free rate.

*q* is the continuous dividend yield.

*S*_{t} is the asset price at
time *t*.

*v*_{t} is the asset price
variance at time *t*.

*J* is the random percentage jump size conditional on the jump
occurring, where `ln`

(1+*J*) is normally distributed with
mean $$\mathrm{ln}(1+{\mu}_{J})-\frac{{\delta}^{2}}{2}$$ and the standard deviation δ, and (1+*J*) has a lognormal distribution:

$$\frac{1}{(1+J)\delta \sqrt{2\pi}}\mathrm{exp}\left\{{\frac{-\left[\mathrm{ln}(1+J)-\left(\mathrm{ln}(1+{\mu}_{J}\right)-\frac{{\delta}^{2}}{2}\right]}{2{\delta}^{2}}}^{2}\right\}$$

where:

*v*_{0} is the initial variance
of the asset price at *t* = 0
(*v*_{0}> 0).

*θ* is the long-term variance level for (*θ* >
0).

*κ* is the mean reversion speed for (*κ* > 0).

*σ*_{v} is the volatility of
variance for (*σ*_{v} > 0).

*p* is the correlation between the Weiner processes
*W*_{t} and $${W}_{t}^{v}$$ for (-1 ≤ *p* ≤ 1).

*μ*_{J} is the mean of
*J* for (*μ*_{J}
> -1).

*δ* is the standard deviation of
`ln`

(1+*J*) for (*δ* ≥ 0).

$${\lambda}_{p}$$ is the annual frequency (intensity) of Poisson process
*P*_{t} for ($${\lambda}_{p}$$ ≥ 0).

## References

[1] Bates, D. S. "Jumps and Stochastic
Volatility: Exchange Rate Processes Implicit in Deutsche Mark Options." *The Review
of Financial Studies.* Vol. 9, Number 1, 1996.

## Version History

**Introduced in R2019a**

### R2022b: Serial date numbers not recommended

Although `optSensByBatesFD`

supports serial date numbers,
`datetime`

values are recommended instead. The
`datetime`

data type provides flexible date and time
formats, storage out to nanosecond precision, and properties to account for time
zones and daylight saving time.

To convert serial date numbers or text to `datetime`

values, use the `datetime`

function. For example:

t = datetime(738427.656845093,"ConvertFrom","datenum"); y = year(t)

y = 2021

There are no plans to remove support for serial date number inputs.

## See Also

`optByLocalVolFD`

| `optSensByLocalVolFD`

| `optByHestonFD`

| `optSensByHestonFD`

| `optByBatesFD`

| `optByMertonFD`

| `optSensByMertonFD`

| `Vanilla`

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

# Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)