## Introduction to volatility models with Matlab (Implied volatility)

Implied volatility (IV) is the volatility of an asset derived from changes in value of corresponding option in such way that if we input IV into option pricing model, it will return theoretical value equal to the current option value. Contrary to historical volatility, IV is the volatility forecast for price of the underlying asset from current time to option expiration . Let’s quickly introduce the Black-Scholes option pricing model. There are multiple ways to derive BSE and you can review them here. The brief solution of BSE can be found here. So the familiar BSE form is

(1)

where

– option value,
– underlying asset spot price,
– risk-free interest,
– current time, date of expiry, time to expiry,
– volatility (in our case implied volatility).

The solution of (1) for value of an call or put option at time can be expressed as

(2)

where

is strike price of an option and is value of normal CDF at particular points . Recall that normal CDF is written

Do you see how deeply is buried? We see that and and since there doesn’t exist the closed form solution of the can’t be expressed analytically. That’s why we use numerical methods and approximation to evaluate implied volatilities. Familiar widely used numerical approaches are Newton-Raphson or secant method. Approximation of IV can be estimated by Bharadia-Christopher-Salkin(1996) model or Corado-Miller(1996) model. Among the latest and most effective estimators we can sort Hallerbach(2004), Jaeckel(2006) and Jaeckel(2013).

For purpose of this article let’s show how to implement just the most basic B-C-S model and secant method.

The B-C-S model is derived as

(3)

where

– time to option expiration,
– current option value,
– underlying asset spot price,
– option strike price( is discounted strike price).

The secant numerical method is given by

(4)

where

is theoretical option value from (2).

Algorithm itself works as follows(suppose computation for one specific ):

1. Compute using (3).
2. Compute theoretical value of an option using (2).
3. Set initial values(initial guess) for secant method, that is
4. and .
5. These temporary variables will change in the secant method loop. Keep in mind that the iterator in (4) of the secant loop is (not !).
6. Compute approximation error(last product on the left side of (4)).
7. Compute new using (4).
8. Compute new using (2)
9. If error < accuracy threshold then last is our from secant method alias implied volatility. Proceed to the next .
10. If error is > accuracy threshold go back to step 6 (proceed to the next ) and don’t forget you need to recompute new values. Use from last secant iteration (note that initial values from step 3. and 4. will not be used in 2nd secant iteration). On every new iteration, variables become variables and new variables are computed.

I will use historical EOD option chain data for BAC stock.

Fig.3 Example option chain .csv file for BAC stock.

If you are wading through my intro to volatility thoroughly you may want to download the example option chain. Option data are very expensive and tough to store and manipulate so it’s nearly impossible to find them free. So now we need to prepare data for IV calculation as follows:

• Use optionparse() function for importing the .csv option chain into matlab table.

• Now we extract dates , adjusted stock spot prices and we choose call options with strike , time to expiry and the ‘risk-free’ interest rate be which was T-Bill rate in the early 2015. Let me point out that in practice “constant” will not be constant because we will not find such options at every time which have exactly half a year expiration. Only finite number of options is offered every . So our will be variable. At every I choose the first option with and . Following code finds forementioned options.

• Our variables and constants are ready. I will demonstrate IV computation for .

1. Calculate initial IV estimate by B-C-S model (3).

2. Compute theoretical value of an option using (2).

3. Set initial values(initial guess) for secant method, that is . Note that I smuggled in the initial error value and secant method accuracy.

4. and .

5. Secant method, steps described in the code.

9. If error < accuracy threshold then last is our .

10. If error > accuracy threshold go to step 6 (next ).