This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

optByHestonFD

Option price by Heston model using finite differences

Syntax

[Price,PriceGrid,AssetPrices,Variances,Times] = optByHestonFD(Rate,AssetPrice,Settle,ExerciseDates,OptSpec,Strike,V0,ThetaV,Kappa,SigmaV,RhoSV)
[Price,PriceGrid,AssetPrices,Variances,Times] = optByHestonFD(___,Name,Value)

Description

example

[Price,PriceGrid,AssetPrices,Variances,Times] = optByHestonFD(Rate,AssetPrice,Settle,ExerciseDates,OptSpec,Strike,V0,ThetaV,Kappa,SigmaV,RhoSV) computes a vanilla European or American option price by the Heston model, using the alternating direction implicit (ADI) method.

example

[Price,PriceGrid,AssetPrices,Variances,Times] = optByHestonFD(___,Name,Value) specifies options using one or more name-value pair arguments in addition to the input arguments in the previous syntax.

Examples

collapse all

Define the option variables and Heston model parameters.

AssetPrice = 10;
Strike = 10;
Rate = 0.1;
Settle = '01-Jan-2017';
ExerciseDates = '02-Apr-2017';

V0 = 0.0625;
ThetaV = 0.16;
Kappa = 5.0;
SigmaV = 0.9;
RhoSV = 0.1;

Compute the American put option price.

OptSpec = 'Put';
Price = optByHestonFD(Rate, AssetPrice, Settle, ...
ExerciseDates, OptSpec, Strike, V0, ThetaV, Kappa, SigmaV, RhoSV, 'AmericanOpt', 1)
Price = 0.5188

Input Arguments

collapse all

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

Data Types: double

Current underlying asset price, specified as numeric value using a scalar numeric.

Data Types: double

Option settlement date, specified as a scalar using serial date numbers, date character vectors, datetime arrays, or string arrays.

Data Types: double | char | datetime | string

Option exercise dates, specified as a serial date number, date character vector, string array, or datetime array:

  • For a European option, there is only one ExerciseDates value and this is the option expiry date.

  • For an American option, use a 1-by-2 vector of exercise date boundaries. The option can be exercised on any tree date between or including the pair of dates on that row. If only one non-NaN date is listed, the option can be exercised between the Settle date and the single listed ExerciseDate.

Data Types: double | char | string | datetime

Definition of the option, specified as a scalar using a cell array of character vectors or string arrays with values 'call' or 'put'.

Data Types: cell | string

Option strike price value, specified as a scalar numeric.

Data Types: double

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

Data Types: double

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

Data Types: double

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

Data Types: double

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

Data Types: double

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

Data Types: double

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: [Price,PriceGrid,AssetPrices,Variances,Times] = optByHestonD(Rate,AssetPrice,Settle,ExerciseDates,OptSpec,Strike,V0,ThetaV,Kappa,SigmaV,RhoSV,'Basis',7)

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

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

Cash dividend amounts, specified as the comma-separated pair consisting of 'DividendAmounts' and a 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

Ex-dividend dates, specified as the comma-separated pair consisting of 'ExDividendDates' and an NDIV-by-1 vector of serial date numbers, date character vectors, string arrays, or datetime arrays.

Data Types: double | char | string | datetime

Maximum price for the price grid boundary, specified as the comma-separated pair consisting of 'AssetPriceMax' and a positive scalar.

Data Types: single | double

Maximum variance to use for the variance grid boundary, specified as the comma-separated pair consisting of 'VarianceMax' as a scalar numeric.

Data Types: double

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

Number of nodes for the variance grid for finite difference grid, specified as the comma-separated pair consisting of 'VarianceGridSize' and a scalar numeric.

Data Types: double

Number of nodes of the time grid for finite difference grid, specified as the comma-separated pair consisting of 'TimeGridSize' and a positive numeric scalar.

Data Types: double

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

Output Arguments

collapse all

Option price, returned as a scalar numeric.

Grid containing prices calculated by the finite difference method, returned as a three-dimensional grid with size AssetGridSizeVarianceGridSizeTimeGridSize. The depth is not necessarily equal to the TimeGridSize, because exercise and ex-dividend dates are added to the time grid. PriceGrid(:, :, end) contains the price for t = 0.

Prices of the asset corresponding to the first dimension of PriceGrid, returned as a vector.

Variances corresponding to the second dimension of PriceGrid, returned as a vector.

Times corresponding to the third dimension of PriceGrid, returned as a vector.

More About

collapse all

Heston Stochastic Volatility Model

The Heston model is an extension of the Black-Scholes model, where the volatility (square root of variance) is no longer assumed to be constant, and the variance now follows a stochastic (CIR) process. This allows modeling the implied volatility smiles observed in the market.

The stochastic differential equation is:

dSt=(rq)Stdt+vtStdWtdvt=κ(θvt)dt+σvvtdWtvE[dWtdWtv]=pdt

where

r is the continuous risk-free rate.

q is the continuous dividend yield.

St is the asset price at time t.

vt is the asset price variance at time t

v0 is the initial variance of the asset price at t = 0 for (v0 > 0).

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

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

σv is the volatility of the variance for (σv > 0).

p is the correlation between the Weiner processes Wt and Wvt for (-1 ≤ p ≤ 1).

References

[1] Heston, S. L. “A Closed-Form Solution for Options with Stochastic Volatility with Applications to Bond and Currency Options.” The Review of Financial Studies. Vol 6, Number 2, 1993.

Introduced in R2018b