LocalVolatilitySurface - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Finance

 LocalVolatilitySurface
 create new local volatility term structure

 Calling Sequence LocalVolatilitySurface(volatility, T, S, opts) LocalVolatilitySurface(riskfreerate, dividendyield, times, strikes, prices, interpolation, delta, opts) LocalVolatilitySurface(riskfreerate, dividendyield, dates, strikes, prices, interpolation, delta, opts) LocalVolatilitySurface(riskfreerate, dividendyield, price, T, K, opts) LocalVolatilitySurface(times, volatilities, opts) LocalVolatilitySurface(dates, volatilities, opts) LocalVolatilitySurface(times, underlyings, volatilities, opts) LocalVolatilitySurface(dates, underlyings, volatilities, opts)

Parameters

 volatility - algebraic expression, operator or procedure; local volatility T - name; variable representing time to maturity S - name; variable representing the value of the underlying riskfreerate - non-negative constant, algebraic expression or a yield term structure; risk-free rate dividendyield - non-negative constant, algebraic expression or a yield term structure; dividend yield times - list or Vector; times (in years) strikes - list, Vector, listlist or Matrix; strike prices of European call options prices - list, Vector, listlist or Matrix; prices of European call options dates - list; dates price - algebraic expression or procedure; price of a European call option K - name; variable representing the strike price volatilities - list, Vector, listlist or Matrix; volatilities underlyings - list or Vector; values of the underlying opts - equations of the form option = value where option is one of daycounter or referencedate; specify options for the LocalVolatilitySurface command

Options

 • daycounter = Actual360, Actual365Fixed, AFB, Bond, Euro, Historical, ISDA, ISMA, OneDay, Simple, Thirty360BondBasis, Thirty360EuroBondBasis, Thirty360European, Thirty360Italian, Thirty360USA, or a day counter data structure -- This option specifies the convention used to convert the amount of time between two dates to year fractions.
 • referencedate = date in any of the formats recognized by the Finance[ParseDate] command -- This option specifies the reference date (date when the discount factor is equal to 1).

Description

 • The LocalVolatilitySurface command creates a new local-volatility term structure with the given parameters. This term structure is represented as a module. This module can be passed to other commands of the Finance package that expect a local volatility term structure as one of the parameters; it can also be used as if it were a procedure. Assume, for example, that the module returned by LocalVolatilitySurface was assigned to the name V. Then for any positive constants T and S, $V\left(T,S\right)$ will return the corresponding value of the local volatility. If one of the parameters T or S is non-numeric, $V\left(T,S\right)$ will return unevaluated.
 • The LocalVolatilitySurface(times, volatilities, opts) and  LocalVolatilitySurface(dates, volatilities, opts) calling sequences create a local-volatility term structure based on a piecewise interpolation of the specified local volatilities at the given times or dates. The times parameter is a list or Vector of times for which local volatilities are available. In this case the value of the local volatility at any time is assumed to be independent of the value of the underlying. The dates parameter must be a list of dates given in any of the formats recognized by the Finance[ParseDate] command. The volatilities parameter is a list or Vector of known volatilities.
 • The LocalVolatilitySurface(times, underlyings, volatilities, opts) and LocalVolatilitySurface(times, underlyings, volatilities, opts) calling sequences create a local-volatility term structure based on a piecewise interpolation of the specified local volatilities at the given times or dates. The underlyings parameter is a list or a Vector of values of the underlying process for which local volatilities are available. In this case the volatilities parameter must be a Matrix. The number of rows of the volatilities matrix must be equal to the number of elements in the underlyings vector. Columns of the volatilities matrix correspond to elements of times or dates. So, ${\mathrm{volatility}}_{i,j}$ is the local volatility at ${\mathrm{times}}_{j}$ (or ${\mathrm{dates}}_{j}$) if the value of the underlying is ${\mathrm{underlyings}}_{i}$.
 • The LocalVolatilitySurface(volatilityfunction, T, S, opts) calling sequence constructs a local-volatility term structure based with the specified volatility function. The parameter volatility can be either a procedure or an algebraic expression. In the first case, the volatility procedure must accept two parameters, T (the time) and S (the value of the underlying), and return the corresponding value of the local volatility. If volatility is given as an algebraic expression, then the variables representing the time and the underlying must be explicitly specified as the second and third parameters.
 • The LocalVolatilitySurface(volatility, T, S, opts) calling sequence constructs a local-volatility term structure based on the given volatility function. The parameter volatility is local volatility given as a function of time from reference and value of the underlying. It can be given either as a Maple procedure or as an algebraic expression. If volatility is given as a procedure it must accept two parameters, time and value of the underlying, and return the corresponding local volatility as a floating-point number. Finally, if volatility is an algebraic expression, it must depend on two variables. In this case the parameters T and S will be used to determine which variable represents time and which variable represents the value of the underlying.
 • The LocalVolatilitySurface(riskfreerate, dividendyield, callprice, T, S, opts) calling sequence constructs a local-volatility term structure implied by the available prices of European call options. The parameter riskfreerate is the instantaneous interest rate, which may be time-dependent. The parameter initialvalue is the initial value of the underlying asset. The parameter callprice is the price of the European call option given as a function of time to maturity and strike price. This parameter can be given either as a procedure or as an algebraic expression. In the first case, callprice must accept two parameters, time to maturity and strike price, and return the corresponding option price. In the second case, callprice must be an algebraic expression depending on at most two variables. The parameters T and K will specify which variable represents time to maturity and which variable represents the strike price.
 • The LocalVolatilitySurface(riskfreerate, dividendyield, times, strikes, prices, opts) and LocalVolatilitySurface(riskfreerate, dividendyield, dates, strikes, prices, opts) calling sequences are similar to the above except that the price function will be determined based on an interpolation of known prices.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$
 > $r≔0.05$
 ${r}{≔}{0.05}$ (1)
 > $d≔0.01$
 ${d}{≔}{0.01}$ (2)
 > $\mathrm{\sigma }≔0.3$
 ${\mathrm{\sigma }}{≔}{0.3}$ (3)

First you will construct a local volatility term structure based on:

 > $C≔\mathrm{BlackScholesPrice}\left(100,K,T,\mathrm{\sigma },r,d,\mathrm{call}\right)$
 ${C}{≔}{100.}{}{{ⅇ}}^{{-}{0.01000000000}{}{T}}{}\left({0.5000000000}{+}{0.5000000000}{}{\mathrm{erf}}{}\left(\frac{{2.357022602}{}\left({\mathrm{ln}}{}\left(\frac{{100.}}{{K}}\right){+}{0.08500000000}{}{T}\right)}{\sqrt{{T}}}\right)\right){-}{1.}{}{{ⅇ}}^{{-}{0.05000000000}{}{T}}{}{K}{}\left({0.5000000000}{+}{0.5000000000}{}{\mathrm{erf}}{}\left(\frac{{2.357022603}{}\left({\mathrm{ln}}{}\left(\frac{{100.}}{{K}}\right){+}{0.08500000000}{}{T}\right)}{\sqrt{{T}}}{-}{0.2121320343}{}\sqrt{{T}}\right)\right)$ (4)
 > $\mathrm{LV}≔\mathrm{LocalVolatilitySurface}\left(r,d,C,T,K\right)$
 ${\mathrm{LV}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (5)
 > $\mathrm{LV}\left(1.0,50\right)$
 ${0.2999999978}$ (6)
 > $\mathrm{LV}\left(1.0,150\right)$
 ${0.3000000008}$ (7)

The following example is based on a piecewise approximation of known local volatilities.

 > $V≔⟨⟨0.30,0.29,0.3⟩|⟨0.31,0.30,0.31⟩|⟨0.32,0.31,0.33⟩|⟨0.33,0.32,0.35⟩⟩$
 ${V}{≔}\left[\begin{array}{cccc}{0.30}& {0.31}& {0.32}& {0.33}\\ {0.29}& {0.30}& {0.31}& {0.32}\\ {0.3}& {0.31}& {0.33}& {0.35}\end{array}\right]$ (8)
 > $T≔⟨0.5,1.0,1.5,2.0⟩$
 ${T}{≔}\left[\begin{array}{c}{0.5}\\ {1.0}\\ {1.5}\\ {2.0}\end{array}\right]$ (9)
 > $S≔⟨95,100,105⟩$
 ${S}{≔}\left[\begin{array}{c}{95}\\ {100}\\ {105}\end{array}\right]$ (10)
 > $\mathrm{LV2}≔\mathrm{LocalVolatilitySurface}\left(T,S,V,\mathrm{Bicubic},\mathrm{referencedate}="Jun-7-2006"\right)$
 ${\mathrm{LV2}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (11)
 > $\mathrm{LV2}\left(0.5,105\right)$
 ${0.3000000000}$ (12)
 > $\mathrm{LV2}\left(0.5,100\right)$
 ${0.2900000000}$ (13)
 > $\mathrm{LV2}\left("Jun-7-2007",105\right)$
 ${0.3100000000}$ (14)
 > $\mathrm{LV2}\left("Jun-7-2007",110\right)$
 ${0.3200000000}$ (15)

Get the interval between the reference date and June 7, 2007 as a fraction of the year.

 > $t≔\mathrm{YearFraction}\left("Jun-7-2006","Jun-7-2007"\right)$
 ${t}{≔}{1.}$ (16)
 > $\mathrm{LV2}\left(t,110\right)$
 ${0.3200000000}$ (17)

In this example you use bi-linear and bi-cubic interpolation of known prices.

 > $T≔⟨\mathrm{seq}\left(0.1i,i=1..20\right)⟩$
 ${T}{≔}\begin{array}{c}\left[\begin{array}{c}{0.1}\\ {0.2}\\ {0.3}\\ {0.4}\\ {0.5}\\ {0.6}\\ {0.7}\\ {0.8}\\ {0.9}\\ {1.0}\\ {⋮}\end{array}\right]\\ \hfill {\text{20 element Vector[column]}}\end{array}$ (18)
 > $K≔⟨\mathrm{seq}\left(90+i,i=1..20\right)⟩$
 ${K}{≔}\begin{array}{c}\left[\begin{array}{c}{91}\\ {92}\\ {93}\\ {94}\\ {95}\\ {96}\\ {97}\\ {98}\\ {99}\\ {100}\\ {⋮}\end{array}\right]\\ \hfill {\text{20 element Vector[column]}}\end{array}$ (19)
 > $A≔\mathrm{Matrix}\left(\left[\mathrm{seq}\left(\left[\mathrm{seq}\left(\mathrm{BlackScholesPrice}\left(100,K\left[i\right],T\left[j\right],\mathrm{\sigma },r,d\right),j=1..20\right)\right],i=1..20\right)\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${A}{≔}\begin{array}{c}\left[\begin{array}{ccccccccccc}{10.0546197200000}& {11.3362579600000}& {12.4764633700000}& {13.5041032800000}& {14.4464465300000}& {15.3220403100000}& {16.1436608700000}& {16.9204464500000}& {17.6591709800000}& {18.3650112200000}& {\dots }\\ {9.23475165000000}& {10.6000482000000}& {11.7844874800000}& {12.8411151600000}& {13.8047152500000}& {14.6970102000000}& {15.5323776700000}& {16.3208625500000}& {17.0697957400000}& {17.7847176900000}& {\dots }\\ {8.44591972000000}& {9.89032783000000}& {11.1154654200000}& {12.1985546900000}& {13.1815190700000}& {14.0890344000000}& {14.9369503000000}& {15.7361386800000}& {16.4944358100000}& {17.2177107900000}& {\dots }\\ {7.69077950000000}& {9.20805131000000}& {10.4698563700000}& {11.5766686600000}& {12.5769942900000}& {13.4981847400000}& {14.3574100800000}& {15.1662793200000}& {15.9330771800000}& {16.6639634900000}& {\dots }\\ {6.97171897000000}& {8.55401599000000}& {9.84802224000000}& {10.9756374100000}& {11.9912287200000}& {12.9244960500000}& {13.7937590200000}& {14.6112651700000}& {15.3856861700000}& {16.1234321300000}& {\dots }\\ {6.29078858000000}& {7.92885261000000}& {9.25022625300000}& {10.3955752900000}& {11.4242626000000}& {12.3679670000000}& {13.2459708100000}& {14.0710539800000}& {14.8522101700000}& {15.5960572000000}& {\dots }\\ {5.64964287000000}& {7.33301923200000}& {8.67663278700000}& {9.83653166600000}& {10.8760897400000}& {11.8285613300000}& {12.7139916700000}& {13.5455815300000}& {14.3325784900000}& {15.0817640600000}& {\dots }\\ {5.04949632200000}& {6.76679835400000}& {8.12730847200000}& {9.29849244500000}& {10.3466590100000}& {11.3062091300000}& {12.1977416700000}& {13.0347625100000}& {13.8267031200000}& {14.5804636400000}& {\dots }\\ {4.49109504200000}& {6.23029734600000}& {7.60222437000000}& {8.78138209900000}& {9.83587610500000}& {10.8008082000000}& {11.6971158600000}& {12.5384916100000}& {13.3344797700000}& {14.0920532500000}& {\dots }\\ {3.97470557400000}& {5.72345184600000}& {7.10125920300000}& {8.28506630400000}& {9.34360545900000}& {10.3122257500000}& {11.2119854600000}& {12.0566445700000}& {12.8557885900000}& {13.6164173600000}& {\dots }\\ {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {}\end{array}\right]\\ \hfill {\text{20 × 20 Matrix}}\end{array}$ (20)
 > $\mathrm{LV3}≔\mathrm{LocalVolatilitySurface}\left(r,d,T,K,A,\mathrm{Bilinear},0.001\right)$
 ${\mathrm{LV3}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (21)
 > $\mathrm{LV4}≔\mathrm{LocalVolatilitySurface}\left(r,d,T,K,A,\mathrm{Bicubic},0.001\right)$
 ${\mathrm{LV4}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (22)

Compute local volatilities based on the bi-linear interpolation.

 > $\mathrm{LV3}\left(1,100\right)$
 ${0.008782621029}$ (23)
 > $\mathrm{LV3}\left(1,105\right)$
 ${0.008904767770}$ (24)
 > $\mathrm{LV3}\left(1.5,100\right)$
 ${0.008467326870}$ (25)
 > $\mathrm{LV3}\left(1.5,105\right)$
 ${0.008628708973}$ (26)

Compute local volatilities based on the bi-cubic interpolation.

 > $\mathrm{LV4}\left(1,100\right)$
 ${0.2814266129}$ (27)
 > $\mathrm{LV4}\left(1,105\right)$
 ${0.2848304402}$ (28)
 > $\mathrm{LV4}\left(1.5,100\right)$
 ${0.2703781495}$ (29)
 > $\mathrm{LV4}\left(1.5,105\right)$
 ${0.2751210861}$ (30)

References

 Brigo, D., Mercurio, F., Interest Rate Models: Theory and Practice, Springer Verlag, 2001.
 Gatheral, J., The Volatility Surface: A Practitioner's Guide, (with foreword by Nassim Taleb), Wiley, 2006.
 Hull, J., Options, Futures, and Other Derivatives, 5th. edition, Prentice Hall, 2003.

Compatibility

 • The Finance[LocalVolatilitySurface] command was introduced in Maple 15.
 • For more information on Maple 15 changes, see Updates in Maple 15.

 See Also