Main Content

Calibrate Pricing Model

Calibrate option pricing model in the Live Editor

Since R2022a

Description

The Calibrate Pricing Model task lets you interactively calibrate an equity, FX, or commodity option pricing model using market data. The task automatically generates MATLAB® code for your live script.

Using this task, you can:

  • Select data.

  • Select a model.

  • Edit parameter constraints.

  • Specify an optimization solver and options.

  • Display the results in a volatility surface plot.

For general information about Live Editor tasks, see Add Interactive Tasks to a Live Script.

Set parameters and solver for model calibration using Calibrate Pricing Model live task

Open the Task

To add the Calibrate Pricing Model task to a live script in the MATLAB Editor:

  • On the Live Editor tab, select Task > Calibrate Pricing Model.

    Selecting the Calibrate Pricing Model task from the Live Editor

  • In a code block in the script, type a relevant keyword, such as calibrate. Select Calibrate Pricing Model from the suggested command completions.

    Selecting the Calibrate Pricing Model task in a code block

Parameters

expand all

Select data enables you to select the data that you want to use to calibrate your pricing model:

  • PriceM-by-N numeric matrix for prices

  • StrikeM-by-N numeric matrix or M-by-1 column vector for strikes and Strike must be a nonnegative value.

  • Discount Curve — Rate curve (ratecurve) for the zero curve

  • Option Type — Put or call option type

  • Maturity — Option maturity dates

  • Spot Price — Current underlying asset price

Select model enables you to select the model type that you want to use to calibrate pricing:

  • Heston — 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 option 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 Wiener processes Wt and Wvt for (-1 ≤ p ≤ 1).

  • Bates — The Bates model 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

    dSt=(rqλpμJ)Stdt+vtStdWt+JStdPtdvt=κ(θvt)dt+σvvtdWtE[dWtdWtv]=pdtprob(dPt=1)=λ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.

    • J is the random percentage jump size conditional on the jump occurring, where ln(1+J) is normally distributed with mean ln(1+μJ)δ22 and the standard deviation δ, and (1+J) has a lognormal distribution:

      1(1+J)δ2πexp{[ln(1+J)(ln(1+μJ)δ22]2δ22}

      where

      • v0 is the initial variance of the asset price at t = 0 (v0> 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 Wiener processes Wt and Wtv for (-1 ≤ p ≤ 1).

      • μJ is the mean of J for (μJ > -1).

      • λp is the annual frequency (intensity) of Poisson process Pt for (λp ≥ 0).

      • δ is the standard deviation of ln(1+J) for (δ ≥ 0).

  • Merton — The Merton jump diffusion model extends the Black-Scholes model by using the Poisson process to include jump diffusion parameters in the modeling of sudden asset price movements (both up and down).

    The stochastic differential equation is

    dSt=(rqλpμj)Stdt+σStdWt+JStdPtprob(dPt=1)=λpdt

    where

    • r is the continuous risk-free rate.

    • q is the continuous dividend yield.

    • Wt is the Wiener process.

    • J is the random percentage jump size conditional on the jump occurring, where ln(1+J) is normally distributed with mean ln(1+μJ)δ22 and the standard deviation δ, and (1+J) has a lognormal distribution:

      1(1+J)δ2πexp{[ln(1+J)(ln(1+μJ)δ22]2δ22}

      where

        • μJ is the mean of J for (μJ > -1).

        • δ is the standard deviation of ln(1+J) for (δ≥ 0).

        • ƛp is the annual frequency (intensity) of Poisson process Ptfor (ƛp ≥ 0).

        • σ is the volatility of the asset price for (σ > 0).

    The parameter constraints displayed in table for editing depend on the model type that you specify from Select model.

    • Heston

      • V0 — Initial variance of the underlying asset

      • ThetaV — Long-term variance of underlying asset

      • Kappa — Mean revision speed for the variance of underlying asset

      • SigmaV — Volatility of the variance of underlying asset

      • RhoSV — Correlation between Wiener processes for underlying asset and its variance

    • Bates

      • V0 — Initial variance of the underlying asset

      • ThetaV — Long-term variance of underlying asset

      • Kappa — Mean revision speed for the variance of underlying asset

      • SigmaV — Volatility of the variance of underlying asset

      • RhoSV — Correlation between Wiener processes for underlying asset and its variance

      • MeanJ — Mean of the random percentage jump size

      • JumpVol — Standard deviation of log(1+J)

      • JumpFreq — Annual frequency of Poisson jump process

    • Merton

      • Volatility — Volatility value for the underlying asset

      • MeanJ — Mean of the random percentage jump size

      • JumpVol — Standard deviation of log(1+J)

      • JumpFreq — Annual frequency of Poisson jump process

    In addition, you can edit the table for Lower Bounds (lb) and Upper Bounds (ub).

    Specify optimization solver and options enables you to specify the solver and options for optimization and visualizing results:

    • Solver

      • lsqnonlin - Non linear least squares — For information, see lsqnonlin.

      • simulannelbnd - Simulated annealing — For information, see simulannealbnd (Global Optimization Toolbox).

    • Text Display

      • Final output

      • Each iteration

      • No display

      For information, see Iterative Display.

    • Plot Function

      • Best value

      • Current value

      • No plot

      For information, see Plot Functions.

    • Tolerance — Termination tolerance of the objective function lsqnonlin or simulannealbnd (Global Optimization Toolbox). Tolerance must be a positive value.

    • Max Iterations — Maximum number of iterations allowed. Max Iterations must be a positive numeric value.

    Select the Volatility Surface Plot check box to display the current optimization results.

    Version History

    Introduced in R2022a

    expand all

    See Also

    Functions