Heston Model Calibration

Calibrate the Heston (1993) stochastic volatility model to each ticker’s option chain: the one set of parameters per ticker that reproduces the market’s implied volatility across the term structure, from about a month to a year and a half, at once.

In the Heston model the variance of the stock follows a mean-reverting square-root process correlated with the stock, \(dS = (r - q) S dt + \sqrt{v} S\) dW_1 and \(dv = \kappa (\theta - v) dt + \sigma \sqrt{v}\) dW_2 with dW_1 dW_2 = \(\rho dt\). Its five parameters read directly: \(\sqrt{v_{0}}\) is today’s volatility, \(\sqrt{\theta}\) the volatility the market expects in the long run, \(\kappa\) how fast it gets there (a half-life of \(\ln (2) / \kappa\) years), \(\sigma\) the volatility of the variance (the curvature of the smile) and \(\rho\) the correlation of the stock with its variance (the skew: negative for equities, whose volatility rises as they fall).

By default the fit uses the listed expiration nearest to each of 1, 2, 3, 6, 9, 12 and 18 months (expiration_months), leaving out those less than 14 calendar days away, so that \(\kappa\) and \(\theta\), which describe how the variance moves across the term structure, are pinned down by expirations far apart. Each expiration contributes its out-of-the-money quotes: the puts below the forward price and the calls above it. Those are the liquid side of the chain; an in-the-money option is mostly its exercise value, so its implied volatility is dominated by the bid-ask spread. The implied volatility of each side (see get_implied_volatility) is cleaned of outliers with the same median-absolute-deviation filter as get_volatility_surface.

The parameters minimize the vega-weighted price errors, to first order the errors in implied volatility, with a soft-l1 loss so that a few stale quotes cannot dominate. Quotes whose vega is below 5% of the at-the-money vega of their expiration are left out. The fit is a bounded least squares from two fixed starting points (see heston_model.get_heston_parameters), with every expiration priced by the COS method of Fang and Oosterlee (2008) with as many terms as the fitted parameters need, so the same quotes always give the same parameters.

The formulas are as follows:

\[\phi(u) = \exp(C + D \cdot v_{0}),\;\; \text{the characteristic function of} \;\ln\left(\frac{S_{T}}{F}\right) \;\text{in the form of Albrecher et}\; \text{al.} \;(2007)\] \[\text{Call} = S \cdot e^{- qT} - \frac{\frac{\sqrt{F \cdot K} \cdot e^{- rT}}{\pi} \cdot \text{∫}_{0}^{\infty} \;\text{Re}\left[e^{\text{iu} \cdot \ln\left(\frac{F}{K}\right)} \cdot \phi\left(u - \frac{i}{2}\right)\right]}{\left(u^{2} + \frac{1}{4}\right) \,\mathrm{d}u}\] \[\text{minimize}\; \Sigma_{i} \text{soft-l1}\left(\frac{\text{Call}_{\text{Heston}}(K_{i},\; T_{i}) - \text{Call}_{\text{BS}}(K_{i},\; T_{i},\; \sigma_{i})}{\text{Vega}_{\text{BS}}(K_{i},\; T_{i},\; \sigma_{i})}\right)\] \[\text{Feller Ratio} = \frac{2 \kappa \theta}{\sigma^{2}}\]

Where S is the price of the underlying quoted with the nearest chain, K the strike, F the forward price, r the continuously compounded risk-free rate, q the continuous dividend yield, T the time to expiration in years (to 16:00 New York time on the expiration date) and \(\sigma_{i}\) the market implied volatility of quote i (a put and a call of the same strike have the same implied volatility error, as both models satisfy put-call parity). A Feller ratio of 1 or more keeps the variance above zero. It is reported rather than imposed: fits to equity smiles commonly break it, because the steep skew asks for a high \(\sigma\).

The RMSE is the root mean squared difference between the implied volatility of the fitted Heston prices, from a COS series converged to 1e-10 per unit of the strike, and the market’s, over the quotes fitted.

See: Heston, S. L. (1993), “A Closed-Form Solution for Options with Stochastic Volatility with Applications to Bond and Currency Options”, The Review of Financial Studies, 6(2), 327-343; Albrecher, H., Mayer, P., Schoutens, W. and Tistaert, J. (2007), “The Little Heston Trap”, Wilmott Magazine; Fang, F. and Oosterlee, C. W. (2008), “A Novel Pricing Method for European Options Based on Fourier-Cosine Series Expansions”, SIAM Journal on Scientific Computing, 31(2), 826-848.

Also known as: Heston calibration, stochastic volatility calibration, Heston model fit.

Notes: Heston is calibrated across the term structure because its parameters describe it: with one expiration, or several within a few weeks, \(\kappa\) and \(\theta\) are hardly identified separately and \(\kappa\) and \(\sigma\) run to their bounds. The expirations under 14 days are left out by default: their smiles are dominated by jump risk (earnings and other events) and by the bid-ask spread, which a diffusion like Heston cannot produce without an implausibly fast mean reversion and volatile variance. The At Bound column names the parameters that end at a bound of the search (v0 and \(\theta\) from 0.0001 to 4, \(\kappa\) from 0.001 to 20, a half-life of under two weeks at 20, \(\sigma\) from 0.01 to 5 and \(\rho\) from -0.999 to 0.999), and a warning is logged with it. A parameter at its bound is a sign that the quotes ask for more than the model has, such as jumps or a humped term structure, and the other parameters then compensate for it, so they are less meaningful. Even within the bounds \(\kappa\) and \(\sigma\) trade off: a faster mean reversion with a more volatile variance gives much the same smile, so on a real surface the fit is flat along that direction and two similar smiles can give a quite different \(\kappa\). The long-run level \(\theta\), the Feller ratio and the at-the-money term structure are far better determined than \(\kappa\) and \(\sigma\) separately. Listed options on single stocks are American; the fit treats their implied volatility as European, as get_volatility_surface does. The Heston prices themselves are available as heston_model.get_heston_price.

Example · AAPL, MSFT

Install the Finance Toolkit with pip install financetoolkit -U, then call get_heston_parameters:

from financetoolkit import Toolkit

toolkit = Toolkit(["AAPL", "MSFT"], api_key="FINANCIAL_MODELING_PREP_KEY")

toolkit.options.get_heston_parameters()

Which returns:

Tickerv0kappathetasigmarhoFeller RatioRMSEQuotesExpirationsAt Bound
AAPL0.06679.63010.09902.1835-0.63060.39990.01583667
MSFT0.180120.00000.14053.4202-0.59240.48050.02154507kappa

2 rows

Parameters

get_heston_parameters accepts the following parameters.

ParameterTypeDescriptionExample
expiration_dateslist[str] | NoneThe expiration dates to fit over, used as given (also those under 14 days). Defaults to None, which picks them with expiration_months.["2027-12-17", "2028-01-21"]
expiration_monthslist[float] | NoneThe times to expiration, in months, whose nearest listed expiration (at least 14 days away, among each ticker’s own dates) is fitted; an expiration nearest to several of them is fitted once. Defaults to None, which uses 1, 2, 3, 6, 9, 12 and 18 months.None, which uses 1, 2, 3, 6, 9, 12 and 18 months
risk_free_ratefloatThe risk free rate to use for the calculation. Defaults to None, which uses the Toolkit’s risk-free rate on the pricing date: the 10-year Treasury yield unless the Toolkit’s risk_free_rate parameter selects ‘13w’, ‘5y’ or ‘30y’, converted from its semi-annual bond-equivalent quote to continuous compounding. A rate passed here is used as given, as a continuously compounded rate.0.04
dividend_yieldfloatThe dividend yield to use for the calculation. Defaults to None, which uses the dividend yield on the pricing date (the dividends of the 365 days up to it relative to its close, as the continuously compounded ln(1 + q)). A given value is used as a continuous yield.0.02
outlier_thresholdfloatThe number of median absolute deviations from the median implied volatility of an expiration beyond which a quote is dropped before fitting. Defaults to 5.0.3.0
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

Share