Path: blob/master/4.2 Volatility smile and model calibration.ipynb
1675 views
Volatility smile and model calibration
Contents
In this notebook, we discuss in a very basic and naive way the implied volatility of options.
The Implied Volatility is that value that must be inserted into the Black-Scholes (BS) formula in order to retrieve the option price quoted in the market:
where is the underlying spot price, is the strike, time to maturity, risk free interest rate and the option price quoted in the market. All these quantities are observable. The only non observable quantity is . However, since BS is an increasing continuous function of , there is a one-one correspondence
where all the other variables are kept fixed. For this reasons, it is common to quote option market prices in terms of implied volatilities.
According to the assumptions of the Black-Scholes model, the stock price follows a Geometric Brownian Motion and the implied volatility (IV) should be the same for all , . In practice, however, it depends on both. This relation is called a volatility surface. The dependence of IV on is called term structure, while the dependece on is called volatility smile. In this notebook I will consider only the volatility smile.
But... why does the volatility change for different and ? The sad truth is that the Geometric Brownian Motion is not a good model to describe the underlying dynamics!
And here there are plenty of nice quotes to recall, such as:
"Essentially, all models are wrong, but some are useful". George Box
"The implied volatility is the wrong number to put in the wrong formula to obtain the right price". Riccardo Rebonato [1]
Some models (still wrong, but more useful) that better replicate the price dynamics, and under an appropriate risk neutral measure, are able to reproduce the volatility surface are:
Local volatility models: .
Stochastic volatility models, e.g. Heston model.
Exponential or Geometric Lévy processes, e.g. Merton Jump-Diffusion model, NIG, Variance Gamma.
Combination of stochastic volatility and jumps, e.g. Bates model. These type of models are the best for this purpose (see [2]). The reason is that they describe better the empirical features of the prices, such as volatility clustering and jumps. The presence of many parameters makes these models much more flexible.
Here I consider only the case of stochastic volatility and Lévy processes, since I have already introduced them in the notebooks 1.4 and 1.5.
When considering complex models, it is very difficult to pass from the physical measure to the correct risk neutral measure (which is not unique). For this reason, the best approach is to derive the model parameters directly from the prices (usually European call and put options with different strikes and maturities) already quoted in the market. The process of choosing the risk neutral parameters for a model, such that it reproduces the prices in the market is called model calibration.
How to produce the smile?
Alright... Let us check if the "complex models" mentioned above, are able to reproduce the volatility smile!
In the following cell, I'm going to create the objects for the Black-Scholes, Merton, Variance Gamma and Heston pricers. I chose the values of the process parameters such that the processes have similar variance. The option is a European call with strike , and maturity . We will see below that changing the time to maturity can create problems.
The notation is the same I used in the other notebooks. If you have forgotten it, check the doc:
You can type Heston_param.__doc__
or Heston_param??
in a cell.
Let us create a grid of strikes , and compute the option prices. In this case, the best approach is to use the Fourier Transform method described in the notebook 1.4. This method is super fast!!
Well... if there is a closed formula, why not use it?
The closed formula is always the best solution, but the FFT method is very fast and has a small error. You won't notice the difference.
For VG and Heston there is no closed formula. A possible alternative is to use the Fourier inversion method.
Let's see how small is the error:
Indeed... very small!
Comments:
At short maturities e.g. , the Fourier inversion method may have problems. In our case it may have problems for the VG and Heston model. The reason is that the numerical integration used in the Fourier inversion method has ad-hoc bounds for the truncation of the integral. Usually, for small values of , the tails of the integrand decay very slowly and the ad-hoc bounds produce a truncation error.
Similar problems happen also for other numerical methods. In general, there are always problems in pricing deep OTM (out of the money) options for very short maturities, when the closed formula is not available. The reason is that the error of the numerical method is usually bigger than the option price itself!
Implied volatility
How to find the value such that
for fixed ?
We have to use numerical methods!
The most common methods are the Newton method and the Bisection method. A more advanced method is the Brent method.
Of course all of them are implemented in scipy.optimize
: Newton, Bisection, Brent.
At first sight, the Newton method seems quite good since the derivative of BS with respect to is known analytically:
where N'(x) is the standard normal density and is a variable defined...everywhere 😃 (see notebook 1.1). The Newton method has quadratic convergence if some conditions are satisfied. However, for high values of the VEGA can be very close to zero, and this makes the convergence slow. Instead, the bisection method is a very robust method.
In the function below I use fsolve, which is a very efficient method, as the default method, but with the possibility to switch to the brent method.
Another approach is to find
This is an uncommon method. But it is useful when the root finder is not able to find a solution.
Let us compute the implied volatilities from the prices obtained before.
Let's see if implied_volatility
and implied_vol_minimize
produce the same output.
Plot
Nice plot! We verified that the Heston, Variance Gamma and Merton models produce a smile!!
Lewis representation
In [2], Gatheral suggests an elegant implicit expression for computing the implied volatility (Eq 5.7 page 60) generated by a stocastic process with characteristic function . The expression makes use of the Lewis representation for the option price, that I presented in the notebook 1.4. This version looks slightly different from Eq. 5.7 in [2], but they are equivalent.
The value of can be obtained implicitly from
Replacing :
The implementation of IV_Lewis
is here.
Ok, this method seems a bit slower than the previous, but it can be a good alternative.
Market data
Let's analyze some options market data (the expiration dates were chosen at random). I took the following values from barchart.
The current date is 02 July 2020.
Maturity date: 10 Aug 2020 1 week time to maturity.
Maturity date: 15 Jan 2021 1/2 year time to maturity
This is a set of option prices written on the SPY ETF.
If we assume 252 business days, the time to maturity to the 10th of July corresponds to the year fraction , where 3, 4, and 5 July are holidays. For the 6 months maturity I'm using the Act-365 convention with . Counting the year fraction considering only business days it is more common when dealing with options (see [4]) but in this case I have no idea how many holidays there are till the 15th of January.
The current value of SPY is .
I didn't check the actual interest rate, and I will use a reasonable ad-hoc value. This choice has a very important effect on the values of implied volatility. In a serious analysis you should use the correct value of (which has a term structure dependent on T as well).
Comment:
For for very short times to maturity ( days), it is very difficult to replicate the smile in the ITM and OTM regions. The reasons are several. There can be numerical error issues in the pricing and in the calibration process. Or more simply, the chosen stochastic model is not so good.
Let us recover the implied volatility from option prices.
We can check if the volatilities we computed correspond to the volatilities provided in the CSV file. For this purpose, we consider the Mid-price defined as the average between Bid and Ask prices. The error interval is the interval between Bid IV and Ask IV.
When working with this type of data, frequently happens that the CSV file contains unreliable values of IV:
because the solver was not able to converge.
because other operational errors.
Sometimes the problem is just the choice of using the Mid-price. Choosing another value between the Ask and the Bid price can yield a reliable value of the IV. In this case we can use implied_vol_minimize
, which is able to reduce the error introduced by using the wrong price.
In other cases, the error cannot be reduced and I think it is better to ignore those values.
Plots. Minimization:
Plots. Root finder:
Inconsistent values: when there is no implied volatility able to reproduce the mid-price, the implied_volatility
function returns .
Using implied_vol_minimize
provide values for the put option that implied_volatility
was not able to retrieve. However, it is difficult to say if these values are reliable or not.
Let use ignore the data point with .
Calibration
If we call the set of parameters, the goal is to find the optimal parameters that minimize the following objective function:
where are the market prices, is the pricing function and are weights usually defined as
(they give more importance to the points with smaller spread).
Among the many numerical methods, here I use the following:
curve_fit It uses the
trf
method when the parameters are bounded and theLevemberg-Marquadt
method for unbounded parameters.
For the unconstrained problem (Heston, Merton and VG) I use curve_fit
, while for the constrained Heston problem I use minimize
.
Comment:
In order to make the code simpler, I will only use CALL prices for the calibration.
Merton parameters calibration
VG parameters calibration
Heston parameters calibration
What to do with the Feller condition?
The Feller condition is hardly satisfied in the market, mainly because having implies a high mean reversion which reduces the volatility of the stochastic volatility . The vol of vol is responsible for the convexity of the smile. In order to increase the convexity to match the empirical smile, we have to increase violating the Feller condition. However this is not really an issue, at the moment the reaches we have a positive drift that will push instantly the process away from 0.
Let us calibrate the two cases:
Ignoring the Feller condition (using
curve_fit
).Introducing the Feller condition as an inequality constraint (using
minimize
).
Comment:
The calibration of the Heston pricing model is a difficult task and here I'm adopting a very naive approach. For more information I suggest you look at [3] where the problem is treated rigorously and there is also a literature review.
The calibration of 5 parameters will make the following code quite slow. In [3] there are several suggestions to speed up the code.
Now we can price the options using the just calibrated parameters.
As already explained, the FFT method has problems for deep OTM values and short maturities. We can replace manually the negative values with fake values (we don't care too much about values with magnitude ).
Let us compare the errors of the used pricing models!
I choose MAV instead of MSE because I am only interested in the mean distance between the market price and the model price.
Merton and Heston are the best, while the Heston with Feller condition is the worst.
Implied volatility smile generated by the pricing models!
The pricing models produce a good fit in the neighborhood of the ATM region.
In this region, the Merton model is the best.
Comment:
As expected the Heston model with NO Feller condition provides much better results.
Plots, root finder:
Calibration
Since we found that the Feller condition is not satisfied, I consider only the unconstrained problem.
Now we can price the options using the just calibrated parameters.
Errors
Again the Merton model is the model that performs better.
References
[1] Rebonato, R. (1999) "Volatility and Correlation: In the Pricing of Equity, FX and Interest-Rate Options", Wiley Series in Financial Engineering.
[2] Gatheral, J. (2006) "The Volatility Surface: A Practitioner’s Guide (Wiley Finance Series)", John Wiley & Sons, New York.
[3] Yiran Cui, Sebastian del Baño Rollin, Guido Germano, (2017), "Full and fast calibration of the Heston stochastic volatility model" European Journal of operational research. link
[4] John Hull. "Options, Futures, and Other Derivatives".