Computing Local and

© Maplesoft, a division of Waterloo Maple Inc., 2016

Fitting Implied Volatility Surface

> >

First let us import prices of S&P 500 call options available on October 27, 2006. >

(1.1)

This data can be stored in a DataFrame. > (1.2) (1.2)

Extract data from this DataFrame. > (1.3) The data for the "month" data series needs to be converted to names in order to work with the Finance package: >

(1.4)

Value of the underlying, risk-free rate and dividend yield. > (1.5) > (1.6) > (1.7)

Extract dates and times for which data is available. > >

Implied volatilities for options maturing in December 2006. > (1.8) (1.2)

(1.8)

Extract a subset of the DataFrame corresponding to the observations in December 2006: > (1.9)

Compute the implied volatility for these dates and plot the results: >

(1.10)

> (1.2)

(1.8)

Implied volatilities for options maturing in December 2007. > (1.11)

Extract a subset of the DataFrame corresponding to the observations in December 2007: > (1.12) (1.2)

(1.8)

(1.12)

Compute the implied volatility for these dates and plot the results: >

(1.13)

>

We will use the following model for the volatility surface. (1.2)

(1.8)

(1.12)

>

(1.14)

We can compute the corresponding Black-Scholes price as a function of strike and maturity.

>

(1.15) (1.2)

(1.8)

(1.12)

>

(1.14)

We can use non-linear fitting routines from the statistics data to find the values of that best fit our data. Construct a matrix of parameters and a vector of the corresponding value of the objective function. >

(1.16)

>

(1.17)

>

(1.18)

Here is the corresponding implied volatility function.

>

(1.19)

> (1.2)

(1.8)

(1.12)

>

(1.14)

> (1.2)

(1.8)

(1.12)

>

(1.14)

Here is another way to estimate these parameters. >

(1.20)

>

>

(1.21) (1.2)

(1.8)

(1.12)

>

(1.14)

(1.21)

Here is the corresponding implied volatility function.

>

(1.22)

> (1.2)

(1.8)

(1.12)

>

(1.14)

(1.21)

> (1.2)

(1.8)

(1.12)

>

(1.14)

(1.21)

We can compare both fits with the actual implied volatilities. > >

>

> (1.2)

(1.8)

(1.12)

>

(1.14)

(1.21)

> >

>

> (1.2)

(1.8)

(1.12)

>

(1.14)

(1.21)

Modeling with Local Volatility

We will consider the same model for the local volatility except that in this case we will use parameters that were fit to some market data. >

>

(2.1)

>

> (2.2) (1.2)

(1.8)

(1.12)

>

(1.14)

(1.21)

(2.2) >

(2.3)

>

Consider two functions. The first one returns the Black-Scholes price of a European call for our model. The second one returns the Black-Scholes price of a European for our model. We will assume that these functions are given two us (e.g. obtained by interpolating the market data) and will try to determine the corresponding local volatility term structure. (1.2)

(1.8)

(1.12)

>

(1.14)

(1.21)

(2.2)

>

>

Construct the corresponding local volatility surface. > >

(2.4)

>

(2.5)

>

(2.6)

> >

> > (1.2)

(1.8)

(1.12)

>

(1.14)

(1.21)

(2.2)

>

We can construct the corresponding local volatility surface and implied volatility surface. >

>

We can now construct a Black-Scholes process which has the volatility structure we just obtained. > (2.7) > (1.2)

(1.8)

(1.12)

>

(1.14)

(1.21)

(2.2)

>

>

>

> (2.8)

As an alternative, we can use the implied volatility surface to construct an implied . > > 0.1531851114 (2.9) > 0.1531000000 (2.10) (1.2)

(1.8)

(1.12)

>

(1.14)

(1.21)

(2.2)

>

Compute some option prices. We can use Monte-Carlo simulation to price European- style options and lattice methods to price American-style options.

> (2.11) > (2.12) > 8.477754630 (2.13)

Here is an example of an Asian-type option with European exercise.

>

(2.14)

Legal Notice: The copyright for this application is owned by Maplesoft. The application is intended to demonstrate the use of Maple to solve a particular problem. It has been made available for product evaluation purposes only and may not be used in any other context without the express permission of Maplesoft.