Calibrate Pricing Model
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.
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.
In a code block in the script, type a relevant keyword, such as
calibrate
. Select Calibrate Pricing Model from the suggested command completions.
Parameters
Select data
— Data for model
matrix for Price, Strike,
Maturity | object for Discount Curve | string for Option Type | positive numeric for Spot Price
Select data enables you to select the data that you want to use to calibrate your pricing model:
Price —
M
-by-N
numeric matrix for pricesStrike —
M
-by-N
numeric matrix orM
-by-1
column vector for strikes andStrike
must be a nonnegative value.Discount Curve — Rate curve (
ratecurve
) for the zero curveOption Type — Put or call option type
Maturity — Option maturity dates
Spot Price — Current underlying asset price
Select model
— Specify model type
object for Heston, Bates, or
Merton
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
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
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 and the standard deviation δ, and (1+J) has a lognormal distribution: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 for (-1 ≤ p ≤ 1).
μJ is the mean of J for (μJ > -1).
is the annual frequency (intensity) of Poisson process Pt for ( ≥ 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
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 and the standard deviation δ, and (1+J) has a lognormal distribution: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).
Edit parameter constraints
— Parameter constraints for model and solver
table
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
— Specify solver type and options
drop-down control for Solver, Text
Display, and Plot Function | text box for Tolerance | text box for Max Iterations
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
orsimulannealbnd
(Global Optimization Toolbox).Tolerance
must be a positive value.
Max Iterations — Maximum number of iterations allowed. Max Iterations must be a positive numeric value.
Display results
— Display optimization results
check box to toggle display of Volatility Surface
Plot
Select the Volatility Surface Plot check box to display the current optimization results.
Version History
Introduced in R2022aR2022b: Support for Maximum Iterations
The Specify optimization solver and options section of the Live Editor task supports an option for Max Iterations.
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)