Financial Toolbox    

Plotting Sensitivities of a Portfolio of Options

This example plots gamma as a function of price and time for a portfolio of 10 Black-Scholes options. The plot shows a three-dimensional surface. For each point on the surface, the height (z-value) represents the sum of the gammas for each option in the portfolio weighted by the amount of each option. The x-axis represents changing price, and the y-axis represents time. The plot adds a fourth dimension by showing delta as surface color. This example M-file is ftgex3.m.

First set up the portfolio with arbitrary data. Current prices range from $20 to $90 for each option. Set corresponding exercise prices for each option.

Set all risk-free interest rates to 10%, and set times to maturity in days. Set all volatilities to 0.35. Set the number of options of each instrument, and allocate space for matrices.

For each instrument, create a matrix (of size Time by PLen) of prices for each period.

Create a vector of time periods 1 to Time; and a matrix of times, one column for each price.

Call the toolbox gamma and delta sensitivity functions to compute gamma and delta.

Draw the surface as a mesh, set the viewpoint, and reverse the x-axis because of the viewpoint. The axes range from 20 to 90, 0 to 36, and - to .

Add a title and axis labels and draw a box around the plot. Annotate the colors with a bar and label the colorbar.


  Plotting Sensitivities of an Option Function Reference