Finance - Maple Programming Help

Home : Support : Online Help : Mathematics : Finance : Financial Instruments : Finance/ImpliedVolatilitySurface

Finance

 ImpliedVolatilitySurface
 create new implied volatility term structure

 Calling Sequence ImpliedVolatilitySurface(volatility, T, S, opts) ImpliedVolatilitySurface(riskfreerate, dividendyield, spot, times, strikes, prices, opts) ImpliedVolatilitySurface(riskfreerate, dividendyield, spot, dates, strikes, prices, opts) ImpliedVolatilitySurface(riskfreerate, dividendyield, price, T, K, opts) ImpliedVolatilitySurface(times, volatilities, opts) ImpliedVolatilitySurface(dates, volatilities, opts) ImpliedVolatilitySurface(times, values, volatilities, opts) ImpliedVolatilitySurface(dates, values, volatilities, opts)

Parameters

 volatility - algebraic expression, operator or procedure; implied 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 spot - algebraic expression; initial value of the underlying asset 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 values - list or Vector; values of the underlying opts - equations of the form option = value where option is one of daycounter, interpolation, or referencedate; specify options for the ImpliedVolatilitySurface 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.
 • interpolation = Bilinear or Bicubic -- This option specifies the type of interpolation used to build a volatility surface from a discrete set of rates. The Bilinear interpolation is used by default.
 • 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 ImpliedVolatilitySurface command creates new implied 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 an implied 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 ImpliedVolatilitySurface 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 implied volatility. If one of the parameters $T$ or $S$ is non-numeric, $V\left(T,S\right)$ will return unevaluated.
 • The ImpliedVolatilitySurface(times, volatilities, opts) and  ImpliedVolatilitySurface(dates, volatilities, opts) calling sequences create an implied-volatility term structure based on a piecewise interpolation of the specified implied volatilities at the given times or dates. The implied volatilities are assumed to be strike-independent. The times parameter is a list or Vector of times for which implied volatilities are available. In this case the value of the implied 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 ImpliedVolatilitySurface(times, values, volatilities, opts) and ImpliedVolatilitySurface(dates, values, volatilities, opts) calling sequences create an implied-volatility term structure based on a piecewise interpolation of the specified implied volatilities at the given times or dates. The values parameter is a list or a Vector of values of the underlying process for which implied 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 values vector. Columns of the volatilities matrix correspond to elements of times or dates. So, ${\mathrm{volatility}}_{i,j}$ is the implied volatility at ${\mathrm{times}}_{j}$ (or ${\mathrm{dates}}_{j}$) if the value of the underlying is ${\mathrm{values}}_{i}$.
 • The ImpliedVolatilitySurface(volatility, T, S, opts) calling sequence constructs an implied-volatility term structure based on the given volatility function. The parameter volatility is the implied 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 implied 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 ImpliedVolatilitySurface(riskfreerate, dividendyield, callprice, T, K, opts) calling sequence constructs an implied-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 spot 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 ImpliedVolatilitySurface(riskfreerate, dividendyield, spot, times, strikes, prices, opts) and ImpliedVolatilitySurface(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{σ}≔0.3$
 ${\mathrm{σ}}{:=}{0.3}$ (3)

First construct an implied volatility term structure based on:

 > $C≔\mathrm{BlackScholesPrice}\left(100,K,T,r,\mathrm{σ},d,\mathrm{call}\right)$
 ${C}{:=}{100.}{}{{ⅇ}}^{{-}{0.01000000000}{}{T}}{}\left({0.5000000000}{+}{0.5000000000}{}{\mathrm{erf}}{}\left(\frac{{14.14213562}{}\left({\mathrm{ln}}{}\left(\frac{{100.}}{{K}}\right){+}{0.2912500000}{}{T}\right)}{\sqrt{{T}}}\right)\right){-}{1.}{}{{ⅇ}}^{{-}{0.3000000000}{}{T}}{}{K}{}\left({0.5000000000}{+}{0.5000000000}{}{\mathrm{erf}}{}\left(\frac{{14.14213562}{}\left({\mathrm{ln}}{}\left(\frac{{100.}}{{K}}\right){+}{0.2912500000}{}{T}\right)}{\sqrt{{T}}}{-}{0.03535533905}{}\sqrt{{T}}\right)\right)$ (4)
 > $\mathrm{LV}≔\mathrm{ImpliedVolatilitySurface}\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)$
 ${1.861242223}{}{{10}}^{{41}}$ (6)
 > $\mathrm{LV}\left(1.0,150\right)$
 ${0.1088801580}$ (7)

The following example is based on a piecewise approximation of known implied 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}{r}{95}\\ {100}\\ {105}\end{array}\right]$ (10)
 > $\mathrm{LV2}≔\mathrm{ImpliedVolatilitySurface}\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.3196873473}$ (15)
 > $t≔\mathrm{YearFraction}\left("Jun-7-2006","Jun-7-2017"\right)$
 ${t}{:=}{11.}$ (16)
 > $\mathrm{LV2}\left(t,110\right)$
 ${0.3776241518}$ (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}{:=}\left[\begin{array}{c}{\mathrm{1 .. 20}}{{\mathrm{Vector}}}_{{\mathrm{column}}}\\ {\mathrm{Data Type:}}{\mathrm{anything}}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{Fortran_order}}\end{array}\right]$ (18)
 > $K≔⟨\mathrm{seq}\left(90+i,i=1..20\right)⟩$
 ${K}{:=}\left[\begin{array}{c}{\mathrm{1 .. 20}}{{\mathrm{Vector}}}_{{\mathrm{column}}}\\ {\mathrm{Data Type:}}{\mathrm{anything}}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{Fortran_order}}\end{array}\right]$ (19)
 > $A≔\mathrm{Matrix}\left(\left[\mathrm{seq}\left(\left[\mathrm{seq}\left(\mathrm{BlackScholesPrice}\left(100,{K}_{i},{T}_{j},r,\mathrm{σ},d\right),j=1..20\right)\right],i=1..20\right)\right],\mathrm{datatype}=\mathrm{float}[8]\right)$
 ${A}{:=}\left[\begin{array}{c}{\mathrm{20 x 20}}{\mathrm{Matrix}}\\ {\mathrm{Data Type:}}{{\mathrm{float}}}_{{8}}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{Fortran_order}}\end{array}\right]$ (20)
 > $\mathrm{LV2}≔\mathrm{ImpliedVolatilitySurface}\left(r,d,100,T,K,A,\mathrm{Bilinear}\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}}$ (21)
 > $\mathrm{LV3}≔\mathrm{ImpliedVolatilitySurface}\left(r,d,100,T,K,A,\mathrm{Bicubic}\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}}$ (22)
 > $\mathrm{LV2}\left(1,100\right)$
 ${0.6011620097}$ (23)
 > $\mathrm{LV2}\left(1,105\right)$
 ${0.5527749264}$ (24)
 > $\mathrm{LV2}\left(1.5,100\right)$
 ${0.7016426945}$ (25)
 > $\mathrm{LV2}\left(1.5,105\right)$
 ${0.6658347722}$ (26)
 > $\mathrm{LV3}\left(1,100\right)$
 ${0.6011620097}$ (27)
 > $\mathrm{LV3}\left(1,105\right)$
 ${0.5527749264}$ (28)
 > $\mathrm{LV3}\left(1.5,100\right)$
 ${0.7016426945}$ (29)
 > $\mathrm{LV3}\left(1.5,105\right)$
 ${0.6658347722}$ (30)

In this example you plot implied volatility surface obtained using a piecewise interpolation of known prices.

 > $P≔\mathrm{Matrix}\left(\left[\left[7.20,7.60,8.60,10.0\right],\left[2.85,3.52,5.00,6.30\right],\left[0.50,1.10,2.25,3.50\right],\left[0.05,0.25,0.85,1.85\right],\left[0.05,0.10,0.35,0.85\right]\right]\right)$
 ${P}{:=}\left[\begin{array}{cccc}{7.20}& {7.60}& {8.60}& {10.0}\\ {2.85}& {3.52}& {5.00}& {6.30}\\ {0.50}& {1.10}& {2.25}& {3.50}\\ {0.05}& {0.25}& {0.85}& {1.85}\\ {0.05}& {0.10}& {0.35}& {0.85}\end{array}\right]$ (31)
 > $T≔⟨0.05,0.10,0.35,0.65⟩$
 ${T}{:=}\left[\begin{array}{c}{0.05}\\ {0.10}\\ {0.35}\\ {0.65}\end{array}\right]$ (32)
 > $K≔⟨80.0,85.0,90.0,95.0,100.0⟩$
 ${K}{:=}\left[\begin{array}{c}{80.0}\\ {85.0}\\ {90.0}\\ {95.0}\\ {100.0}\end{array}\right]$ (33)
 > $V≔\mathrm{Finance}:-\mathrm{ImpliedVolatilitySurface}\left(0.05,0.00,87,T,K,P,\mathrm{Bicubic}\right)$
 ${V}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (34)
 > $\mathrm{plot3d}\left(V,0.05..0.65,80..100,\mathrm{orientation}=\left[-145,75\right],\mathrm{axes}=\mathrm{BOXED}\right)$

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[ImpliedVolatilitySurface] command was introduced in Maple 15.