PyQuant News is on Substack

Looking for the newest weekly Python deep dives for algorithmic trading, market data analysis, and quant finance? Subscribe to the PyQuant Newsletter on Substack for free.

Subscribe for free 👉

Calibrating volatility smiles with SABR

November 4, 2023
Facebook logo.
Twitter logo.
LinkedIn logo.
Newsletter issue count indicatorNewsletter total issues indicator
Calibrating volatility smiles with SABR

Calibrating volatility smiles with SABR

In today's newsletter, we’ll explore the SABR stochastic volatility model.

It’s a very popular volatility model used by professionals for many types of derivatives.

Today, we’ll look at how to calibrate the SABR parameters and use them to fit a volatility smile for equity options.

Sound good?

Let’s go!

Calibrating volatility smiles with SABR

The SABR model, built in 2002, stands as a key stochastic volatility framework in finance for modeling derivatives. SABR stands for "stochastic alpha, beta, rho" which are the key inputs to the model.

SABR is good at capturing the market-observed anomalies such as skew and smile.

It operates on the premise that asset prices follow a geometric Brownian motion while volatility follows an Ornstein-Uhlenbeck process, parameterized by alpha (initial volatility level), beta (variance elasticity), rho (price-volatility correlation), and nu (volatility's volatility).

One of its standout features is the closed-form approximation for implied volatility—known as the Hagan formula—which allows for fast and accurate computations of implied volatility across strike prices.

Ready?!

Imports and set up

We’ll use the pysabr library to calibrate the SABR model, fit the volatility smile, and price options. Let’s import the libraries.

We’ll use OpenBB to fetch options prices for a ticker.

From here, we’ll grab the calls and puts at the specified expiration.

We filter the DataFrame for call and put options at the given expiration. We then compute the mid price to get a more accurate picture of implied volatility. We’ll need the strikes and market implied volatilities, too.

Fit the SABR model

First, we compute the forward stock price using put-call parity, set the expiration, and assign a beta.

Put-call parity defines the relationship between put options, call options, and the forward price of the underlying. You can read more here. The t parameter is the fraction of time until expiration.

The beta parameter governs the shape of the forward rate, which influences the shape of the implied volatility smile. A beta of 1 implies a lognormal distribution, which is consistent with the Black-Scholes model. Moving beta away from 1 allows for different shapes of volatility smiles. In practice, setting beta to 0.5 is usually a safe bet.

Once we set the parameters, we instantiate the model and call fit to get alpha, rho, and volvol.

The fit method calibrates the SABR model parameters to best fit a given volatility smile. The alpha parameter is a measure of the at-the-money volatility level, rho represents the correlation between the asset price and its volatility, and volvol which is the volatility of volatility.

Generate a fitted volatility smile

Now that we have alpha, rho, and volvol, we can generate the calibrated volatility smile.

This code generates a lognormal volatility for each strike in our options chain.

Let’s plot it.

The result is a fitted volatility smile (or smirk in this case), along with the market based volatility smile.

Calibrating volatility smiles with SABR. The SABR model is a key stochastic volatility framework in finance for modeling derivatives.

We can assess the model error as well.

The result is a bar chart which demonstrates the model error for each strike price based on the calibrated implied volatility from the SABR model.

Calibrating volatility smiles with SABR. The SABR model is a key stochastic volatility framework in finance for modeling derivatives.

Next steps

We breezed over a lot of the theory behind the SABR model. As a next step, take a look at the Wikipedia article on the SABR model. It will help get more intuition behind what’s happening.