Main Content

optSensByMertonFFT

Option price and sensitivities by Merton76 model using FFT and FRFT

Description

[PriceSens,StrikeOut] = optSensByMertonFFT(Rate,AssetPrice,Settle,Maturity,OptSpec,Strike,Sigma,MeanJ,JumpVol,JumpFreq) computes vanilla European option price and sensitivities by Merton76 model, using Carr-Madan FFT and Chourdakis FRFT methods.

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.

example

[PriceSens,StrikeOut] = optSensByMertonFFT(___,Name,Value) adds optional name-value pair arguments.

example

Examples

collapse all

Use optSensByMertonFFT to calibrate the FFT strike grid for sensitivities, compute option sensitivities, and plot option sensitivity surfaces.

Define Option Variables and Merton76 Model Parameters

AssetPrice = 80;
Rate = 0.03;
DividendYield = 0.02;
OptSpec = 'call';

Sigma = 0.16;
MeanJ = 0.02;
JumpVol = 0.08;
JumpFreq = 2;

Compute the Option Prices for the Entire FFT (or FRFT) Strike Grid, Without Specifying "Strike"

Compute option sensitivities and also output the corresponding strikes. If the Strike input is empty ( [] ), option sensitivities will be computed on the entire FFT (or FRFT) strike grid. The FFT (or FRFT) strike grid is determined as exp(log-strike grid), where each column of the log-strike grid has NumFFT points with LogStrikeStep spacing that are roughly centered around each element of log(AssetPrice). The default value for NumFFT is 2^12. In addition to the sensitivities in the first output, the optional last output contains the corresponding strikes.

Settle = datetime(2017,6,29);
Maturity = datemnth(Settle, 6);
Strike = []; % Strike is not specified

[Delta, Kout] = optSensByMertonFFT(Rate, AssetPrice, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, 'OutSpec', "delta");

% Show the lowest and highest strike values on the FFT strike grid
format
[Kout(1) Kout(end)]
ans = 1×2
10138 ×

    0.0000    1.8798

% Show a subset of the strikes and corresponding option sensitivities
Range = (2046:2052);
[Kout(Range) Delta(Range)]
ans = 7×2

   50.4929    0.9895
   58.8640    0.9801
   68.6231    0.8816
   80.0000    0.5283
   93.2631    0.1551
  108.7251    0.0241
  126.7505    0.0025

Change the Number of FFT (or FRFT) Points and Compare with optSensByMertonNI

Try a different number of FFT (or FRFT) points, and compare the results with numerical integration. Unlike optSensByMertonFFT, which uses FFT (or FRFT) techniques for fast computation across the whole range of strikes, the optSensByMertonNI function uses direct numerical integration and it is typically slower, especially for multiple strikes. However, the values computed by optSensByMertonNI can serve as a benchmark for adjusting the settings for optSensByMertonFFT.

% Try a smaller number of FFT points 
% (e.g. for faster performance or smaller memory footprint)
NumFFT = 2^10; % Smaller than the default value of 2^12
Strike = []; % Strike is not specified (will use the entire FFT strike grid)
[Delta, Kout] = optSensByMertonFFT(Rate, AssetPrice, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, 'OutSpec', "delta", ...
    'NumFFT', NumFFT);

% Compare with numerical integration method
Range = (510:516);
Strike = Kout(Range);
DeltaFFT = Delta(Range);
DeltaNI = optSensByMertonNI(Rate, AssetPrice, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, 'OutSpec', "delta");
Error = abs(DeltaFFT-DeltaNI);
table(Strike, DeltaFFT, DeltaNI, Error)
ans=7×4 table
    Strike     DeltaFFT      DeltaNI        Error   
    ______    __________    __________    __________

    12.696       0.89726       0.99002      0.092766
    23.449       0.93421       0.99002       0.05581
    43.312       0.94691       0.99001      0.043093
        80       0.50983       0.52827      0.018446
    147.76      0.004147    0.00019101      0.003956
    272.93      0.001071     1.547e-09      0.001071
    504.11    0.00030521    5.7578e-10    0.00030521

Make Further Adjustments to FFT (or FRFT)

If the values in the output DeltaFFT are significantly different from those in DeltaNI, try making adjustments to optSensByMertonFFT settings, such as CharacteristicFcnStep, LogStrikeStep, NumFFT, DampingFactor, and so on. Note that if (LogStrikeStep * CharacteristicFcnStep) is 2*pi/ NumFFT, FFT is used. Otherwise, FRFT is used.

Strike = []; % Strike is not specified (will use the entire FFT or FRFT strike grid)
[Delta, Kout] = optSensByMertonFFT(Rate, AssetPrice, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, 'OutSpec', "delta", ...
    'NumFFT', NumFFT, 'CharacteristicFcnStep', 0.065, 'LogStrikeStep', 0.001);

% Compare with numerical integration method
Strike = Kout(Range);
DeltaFFT = Delta(Range);
DeltaNI = optSensByMertonNI(Rate, AssetPrice, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, 'OutSpec', "delta");
Error = abs(DeltaFFT-DeltaNI);
table(Strike, DeltaFFT, DeltaNI, Error)
ans=7×4 table
    Strike    DeltaFFT    DeltaNI      Error   
    ______    ________    _______    __________

    79.76     0.53701     0.53701    5.6407e-12
    79.84      0.5341      0.5341    5.3257e-12
    79.92     0.53119     0.53119    5.0099e-12
       80     0.52827     0.52827    4.6956e-12
    80.08     0.52536     0.52536    4.3811e-12
    80.16     0.52245     0.52245    4.0652e-12
    80.24     0.51953     0.51953    3.7503e-12

% Save the final FFT (or FRFT) strike grid for future reference. For
% example, it provides information about the range of Strike inputs for
% which the FFT (or FRFT) operation is valid.
FFTStrikeGrid = Kout;
MinStrike = FFTStrikeGrid(1) % Strike cannot be less than MinStrike
MinStrike = 
47.9437
MaxStrike = FFTStrikeGrid(end) % Strike cannot be greater than MaxStrike
MaxStrike = 
133.3566

Compute the Option Sensitivity for a Single Strike

Once the desired FFT (or FRFT) settings are determined, use the Strike input to specify the strikes rather than providing an empty array. If the specified strikes do not match a value on the FFT (or FRFT) strike grid, the outputs are interpolated on the specified strikes.

Settle = datetime(2017,6,29);
Maturity = datemnth(Settle, 6);
Strike = 80;

Delta = optSensByMertonFFT(Rate, AssetPrice, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, 'OutSpec', "delta", ...
    'NumFFT', NumFFT, 'CharacteristicFcnStep', 0.065, 'LogStrikeStep', 0.001)
Delta = 
0.5283

Compute the Option Sensitivities for a Vector of Strikes

Use the Strike input to specify the strikes.

Settle = datetime(2017,6,29);
Maturity = datemnth(Settle, 6);
Strike = (76:2:84)';

Delta = optSensByMertonFFT(Rate, AssetPrice, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, 'OutSpec', "delta", ...
    'NumFFT', NumFFT, 'CharacteristicFcnStep', 0.065, 'LogStrikeStep', 0.001)
Delta = 5×1

    0.6727
    0.6013
    0.5283
    0.4565
    0.3883

Compute the Option Sensitivities for a Vector of Strikes and a Vector of Dates of the Same Lengths

Use the Strike input to specify the strikes. Also, the Maturity input can be a vector, but it must match the length of the Strike vector if the ExpandOutput name-value pair argument is not set to "true".

Settle = datetime(2017,6,29);
Maturity = datemnth(Settle, [12 18 24 30 36]); % Five maturities
Strike = [76 78 80 82 84]'; % Five strikes

Delta = optSensByMertonFFT(Rate, AssetPrice, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, 'OutSpec', "delta", ...
    'NumFFT', NumFFT, 'CharacteristicFcnStep', 0.065, ...
    'LogStrikeStep', 0.001) % Five values in vector output
Delta = 5×1

    0.6419
    0.5907
    0.5565
    0.5311
    0.5110

Expand the Outputs for a Surface

Set the ExpandOutput name-value pair argument to "true" to expand the outputs into NStrikes-by-NMaturities matrices. In this case, they are square matrices.

[Delta, Kout] = optSensByMertonFFT(Rate, AssetPrice, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, 'OutSpec', "delta", ...
    'NumFFT', NumFFT, 'CharacteristicFcnStep', 0.065, ...
    'LogStrikeStep', 0.001, 'ExpandOutput', true) % (5 x 5) matrix output
Delta = 5×5

    0.6419    0.6305    0.6245    0.6204    0.6173
    0.5922    0.5907    0.5905    0.5905    0.5905
    0.5422    0.5507    0.5565    0.5607    0.5637
    0.4927    0.5112    0.5229    0.5311    0.5372
    0.4447    0.4725    0.4898    0.5020    0.5110

Kout = 5×5

    76    76    76    76    76
    78    78    78    78    78
    80    80    80    80    80
    82    82    82    82    82
    84    84    84    84    84

Compute the Option Sensitivities for a Vector of Strikes and a Vector of Dates of Different Lengths

When ExpandOutput is "true", NStrikes do not have to match NMaturities. That is, the output NStrikes-by-NMaturities matrix can be rectangular.

Settle = datetime(2017,6,29);
Maturity = datemnth(Settle, 12*(0.5:0.5:3)'); % Six maturities
Strike = (76:2:84)'; % Five strikes

Delta = optSensByMertonFFT(Rate, AssetPrice, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, 'OutSpec', "delta", ...
    'NumFFT', NumFFT, 'CharacteristicFcnStep', 0.065, ...
    'LogStrikeStep', 0.001, 'ExpandOutput', true) % (5 x 6) matrix output
Delta = 5×6

    0.6727    0.6419    0.6305    0.6245    0.6204    0.6173
    0.6013    0.5922    0.5907    0.5905    0.5905    0.5905
    0.5283    0.5422    0.5507    0.5565    0.5607    0.5637
    0.4565    0.4927    0.5112    0.5229    0.5311    0.5372
    0.3883    0.4447    0.4725    0.4898    0.5020    0.5110

Compute the Option Sensitivities for a Vector of Strikes and a Vector of Asset Prices

When ExpandOutput is "true", the output can also be a NStrikes-by-NAssetPrices rectangular matrix by accepting a vector of asset prices.

Settle = datetime(2017,6,29);
Maturity = datemnth(Settle, 12); % Single maturity
ManyAssetPrices = [70 75 80 85]; % Four asset prices
Strike = (76:2:84)'; % Five strikes

Delta = optSensByMertonFFT(Rate, ManyAssetPrices, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, 'OutSpec', "delta", ...
    'NumFFT', NumFFT, 'CharacteristicFcnStep', 0.065, ...
    'LogStrikeStep', 0.001, 'ExpandOutput', true) % (5 x 4) matrix output
Delta = 5×4

    0.3796    0.5157    0.6419    0.7472
    0.3315    0.4637    0.5922    0.7043
    0.2874    0.4137    0.5422    0.6592
    0.2474    0.3664    0.4927    0.6128
    0.2117    0.3224    0.4447    0.5657

Plot Option Sensitivity Surfaces

Use the Strike input to specify the strikes. Increase the value for NumFFT to support a wider range of strikes. Also, the Maturity input can be a vector. Set ExpandOutput to "true" to output the surfaces as NStrikes-by-NMaturities matrices.

Settle = datetime(2017,6,29);
Maturity = datemnth(Settle, 12*[1/12 0.25 (0.5:0.5:3)]');
Times = yearfrac(Settle, Maturity);
Strike = (2:2:200)';

% Increase 'NumFFT' to support a wider range of strikes
NumFFT = 2^13;

[Delta, Gamma, Rho, Theta, Vega] = optSensByMertonFFT(...
    Rate, AssetPrice, Settle, Maturity, OptSpec, Strike, ...
    Sigma, MeanJ, JumpVol, JumpFreq, 'DividendYield', DividendYield, ...
    'NumFFT', NumFFT, 'CharacteristicFcnStep', 0.065, 'LogStrikeStep', 0.001, ...
    'OutSpec', ["delta", "gamma", "rho", "theta", "vega"], ...
    'ExpandOutput', true);

[X,Y] = meshgrid(Times,Strike);

figure;
surf(X,Y,Delta);
title('Delta');
xlabel('Years to Option Expiry');
ylabel('Strike');
view(-112,34);
xlim([0 Times(end)]);

Figure contains an axes object. The axes object with title Delta, xlabel Years to Option Expiry, ylabel Strike contains an object of type surface.

figure;
surf(X,Y,Gamma)
title('Gamma')
xlabel('Years to Option Expiry')
ylabel('Strike')
view(-112,34);
xlim([0 Times(end)]);

Figure contains an axes object. The axes object with title Gamma, xlabel Years to Option Expiry, ylabel Strike contains an object of type surface.

figure;
surf(X,Y,Rho)
title('Rho')
xlabel('Years to Option Expiry')
ylabel('Strike')
view(-112,34);
xlim([0 Times(end)]);

Figure contains an axes object. The axes object with title Rho, xlabel Years to Option Expiry, ylabel Strike contains an object of type surface.

figure;
surf(X,Y,Theta)
title('Theta')
xlabel('Years to Option Expiry')
ylabel('Strike')
view(-112,34);
xlim([0 Times(end)]);

Figure contains an axes object. The axes object with title Theta, xlabel Years to Option Expiry, ylabel Strike contains an object of type surface.

figure;
surf(X,Y,Vega)
title('Vega')
xlabel('Years to Option Expiry')
ylabel('Strike')
view(-112,34);
xlim([0 Times(end)]);

Figure contains an axes object. The axes object with title Vega, xlabel Years to Option Expiry, ylabel Strike contains an object of type surface.

Input Arguments

collapse all

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

Data Types: double

Current underlying asset price, specified as numeric value using a scalar or a NINST-by-1 or NColumns-by-1 vector.

For more information on the proper dimensions for AssetPrice, see the name-value pair argument ExpandOutput.

Data Types: double

Option settlement date, specified as a NINST-by-1 or NColumns-by-1 vector using a datetime array, string array, or date character vectors. The Settle date must be before the Maturity date.

To support existing code, optSensByMertonFFT also accepts serial date numbers as inputs, but they are not recommended.

For more information on the proper dimensions for Settle, see the name-value pair argument ExpandOutput.

Option maturity date, specified as a NINST-by-1 or NColumns-by-1 vector using a datetime array, string array, or date character vectors.

To support existing code, optSensByMertonFFT also accepts serial date numbers as inputs, but they are not recommended.

For more information on the proper dimensions for Maturity, see the name-value pair argument ExpandOutput.

Definition of the option, specified as a NINST-by-1 or NColumns-by-1 vector using a cell array of character vectors or string arrays with values 'call' or 'put'.

For more information on the proper dimensions for OptSpec, see the name-value pair argument ExpandOutput.

Data Types: cell | string

Option strike price value, specified as a NINST-by-1, NRows-by-1, NRows-by-NColumns vector of strike prices.

If this input is an empty array ([]), option prices are computed on the entire FFT (or FRFT) strike grid, which is determined as exp(log-strike grid). Each column of the log-strike grid has'NumFFT' points with 'LogStrikeStep' spacing that are roughly centered around each element of log(AssetPrice).

For more information on the proper dimensions for Strike, see the name-value pair argument ExpandOutput.

Data Types: double

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

Data Types: double

Mean of the random percentage jump size (J), specified as a scalar decimal value where log(1+J) is normally distributed with mean (log(1+MeanJ)-0.5*JumpVol^2) and the standard deviation JumpVol.

Data Types: double

Standard deviation of log(1+J) where J is the random percentage jump size, specified as a scalar decimal value.

Data Types: double

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

Data Types: double

Name-Value Arguments

collapse all

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,StrikeOut] = optSensByMertonFFT(Rate,AssetPrice,Settle,Maturity,OptSpec,Strike,Sigma,MeanJ,JumpVol,JumpFreq,'Basis',7)

Day-count 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 value.

Data Types: double

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 the initial volatility sqrt(V0).

Example: OutSpec = ["price","delta","gamma","vega","rho","theta"]

Data Types: string | cell

Number of grid points in the characteristic function variable and in each column of the log-strike grid, specified as the comma-separated pair consisting of 'NumFFT' and a scalar numeric value.

Data Types: double

Characteristic function variable grid spacing, specified as the comma-separated pair consisting of 'CharacteristicFcnStep' and a scalar numeric value.

Data Types: double

Log-strike grid spacing, specified as the comma-separated pair consisting of 'LogStrikeStep' and a scalar numeric value.

Note

If (LogStrikeStep*CharacteristicFcnStep) is 2*pi/NumFFT, FFT is used. Otherwise, FRFT is used.

Data Types: double

Damping factor for Carr-Madan formulation, specified as the comma-separated pair consisting of 'DampingFactor' and a scalar numeric value.

Data Types: double

Type of quadrature, specified as the comma-separated pair consisting of 'Quadrature' and a single character vector or string array with a value of 'simpson' or 'trapezoidal'.

Data Types: char | string

Flag to expand the outputs, specified as the comma-separated pair consisting of 'ExpandOutput' and a logical:

  • true — If true, the outputs are NRows-by- NColumns matrices. NRows is the number of strikes for each column and it is determined by the Strike input. For example, Strike can be a NRows-by-1 vector, or a NRows-by-NColumns matrix. If Strike is empty, NRows is equal to NumFFT. NColumns is determined by the sizes of AssetPrice, Settle, Maturity, and OptSpec, which must all be either scalar or NColumns-by-1 vectors.

  • false — If false, the outputs are NINST-by-1 vectors. Also, the inputs Strike, AssetPrice, Settle, Maturity, and OptSpec must all be either scalar or NINST-by-1 vectors.

Data Types: logical

Output Arguments

collapse all

Option prices or sensitivities, returned as a NINST-by-1, or NRows-by-NColumns, depending on ExpandOutput. The name-value pair argument OutSpec determines the types and order of the outputs.

Strikes corresponding to Price, returned as a NINST-by-1, or NRows-by-NColumns, depending on ExpandOutput.

More About

collapse all

References

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

[2] Carr, P., and D.B. Madan. “Option Valuation Using the Fast Fourier Transform.” Journal of Computational Finance. Vol 2. No. 4. 1999.

[3] Cont, R. and P. Tankov. Financial Modeling with Jump Processes. Chapman & Hall/CRC Press, 2004.

[4] Chourdakis, K. “Option Pricing Using Fractional FFT.” Journal of Computational Finance. 2005.

[5] Merton, R. “Option Pricing When Underlying Stock Returns are Discontinuous.” Journal of Financial Economics. Vol 3. 1976.

Version History

Introduced in R2018a

expand all