Finance - Maple Programming Help

Home : Support : Online Help : Mathematics : Finance : Financial Instruments : Greeks : Finance/BlackScholesDelta

Finance

 BlackScholesDelta
 compute the Delta of a European-style option with given payoff

 Calling Sequence BlackScholesDelta(${S}_{0}$, K, T, sigma, r, d, optiontype) BlackScholesDelta(${S}_{0}$, P, T, sigma, r, d)

Parameters

 ${S}_{0}$ - algebraic expression; initial (current) value of the underlying asset K - algebraic expression; strike price T - algebraic expression; time to maturity sigma - algebraic expression; volatility r - algebraic expression; continuously compounded risk-free rate d - algebraic expression; continuously compounded dividend yield P - operator or procedure; payoff function optiontype - call or put; option type

Description

 • The Delta of an option or a portfolio of options is the sensitivity of the option or portfolio to changes in the value of the underlying asset

$\mathrm{\Delta }=\frac{\partial }{\partial {S}_{0}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}S$

 • The BlackScholesDelta command computes the Delta of a European-style option with the specified payoff function.
 • The parameter ${S}_{0}$ is the initial (current) value of the underlying asset. The parameter T is the time to maturity in years.
 • The parameter K specifies the strike price if this is a vanilla put or call option. Any payoff function can be specified using the second calling sequence. In this case the parameter P must be given in the form of an operator, which accepts one parameter (spot price at maturity) and returns the corresponding payoff.
 • The sigma, r, and d parameters are the volatility, the risk-free rate, and the dividend yield of the underlying asset. These parameters can be given in either the algebraic form or the operator form. The parameter d is optional. By default, the dividend yield is taken to be 0.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$

First compute the Delta of a European call option with strike price 100, which matures in 1 year. This will define the Delta as a function of the risk-free rate, the dividend yield, and the volatility.

 > $\mathrm{BlackScholesDelta}\left(100,100,1,\mathrm{σ},r,d,'\mathrm{call}'\right)$
 ${-}\frac{{1}}{{2}}{}{{ⅇ}}^{{-}{d}}{}\left({\mathrm{erf}}{}\left(\frac{{1}}{{4}}{}\frac{\left({-}{{\mathrm{σ}}}^{{2}}{+}{2}{}{d}{-}{2}{}{r}\right){}\sqrt{{2}}}{{\mathrm{σ}}}\right){-}{1}\right)$ (1)

In this example you will use numeric values for the risk-free rate, the dividend yield, and the volatility.

 > $\mathrm{BlackScholesDelta}\left(100,100,1,0.3,0.05,0.03,'\mathrm{call}'\right)$
 ${0.568453937}$ (2)

You can also use the generic method in which the option is defined through its payoff function.

 > $\mathrm{BlackScholesDelta}\left(100,t→\mathrm{max}\left(t-100,0\right),1,\mathrm{σ},r,d\right)$
 ${-}\frac{{1}}{{2}}{}{{ⅇ}}^{{-}{d}}{}\left({\mathrm{erf}}{}\left(\frac{{1}}{{4}}{}\frac{\left({-}{{\mathrm{σ}}}^{{2}}{+}{2}{}{d}{-}{2}{}{r}\right){}\sqrt{{2}}}{{\mathrm{σ}}}\right){-}{1}\right)$ (3)
 > $\mathrm{BlackScholesDelta}\left(100,t→\mathrm{max}\left(t-100,0\right),1,0.3,0.05,0.03\right)$
 ${0.5684539378}$ (4)
 > $\mathrm{Δ}≔\mathrm{BlackScholesDelta}\left(100,100,1,\mathrm{σ},r,0.03,'\mathrm{call}'\right)$
 ${\mathrm{Δ}}{≔}\frac{{0.4852227668}{}{\mathrm{σ}}{+}{0.4852227668}{}{\mathrm{erf}}{}\left(\frac{{-}{0.02121320343}{+}{0.707106781}{}{r}{+}{0.3535533905}{}{{\mathrm{σ}}}^{{2}}}{{\mathrm{σ}}}\right){}{\mathrm{σ}}{+}{0.387151754}{}{{ⅇ}}^{{-}\frac{{0.00004999999997}{}{\left({50.}{}{{\mathrm{σ}}}^{{2}}{+}{100.}{}{r}{-}{3.}\right)}^{{2}}}{{{\mathrm{σ}}}^{{2}}}}{-}{0.3989422803}{}{{ⅇ}}^{{-}\frac{{1.}{}\left({0.5000000002}{}{r}{}{{\mathrm{σ}}}^{{2}}{+}{0.0004499999998}{-}{0.02999999998}{}{r}{+}{0.01499999999}{}{{\mathrm{σ}}}^{{2}}{+}{0.4999999997}{}{{r}}^{{2}}{+}{0.1249999999}{}{{\mathrm{σ}}}^{{4}}\right)}{{{\mathrm{σ}}}^{{2}}}}}{{\mathrm{σ}}}$ (5)
 > $\mathrm{plot3d}\left(\mathrm{Δ},\mathrm{σ}=0..1,r=0..1,\mathrm{axes}=\mathrm{BOXED}\right)$ Here are similar examples for the European put option.

 > $\mathrm{BlackScholesDelta}\left(100,120,1,\mathrm{σ},r,d,'\mathrm{put}'\right)$
 $\frac{{1}}{{10}}{}\frac{{-}{5}{}{{ⅇ}}^{{-}{d}}{}{\mathrm{erf}}{}\left(\frac{{1}}{{4}}{}\frac{\left({2}{}{\mathrm{ln}}{}\left(\frac{{6}}{{5}}\right){-}{{\mathrm{σ}}}^{{2}}{+}{2}{}{d}{-}{2}{}{r}\right){}\sqrt{{2}}}{{\mathrm{σ}}}\right){}\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}{-}{5}{}{{ⅇ}}^{{-}{d}}{}\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}{+}{5}{}{{ⅇ}}^{{-}\frac{{1}}{{8}}{}\frac{{{\mathrm{σ}}}^{{2}}{}{\mathrm{ln}}{}\left(\frac{{625}}{{1296}}\right){+}{4}{}{{\mathrm{ln}}{}\left({2}\right)}^{{2}}{+}{\mathrm{ln}}{}\left({5}\right){}{\mathrm{ln}}{}\left(\frac{{1}}{{256}}\right){+}{\mathrm{ln}}{}\left(\frac{{2}}{{5}}\right){}{\mathrm{ln}}{}\left({6561}\right){+}{d}{}{\mathrm{ln}}{}\left(\frac{{1679616}}{{390625}}\right){+}{r}{}{\mathrm{ln}}{}\left(\frac{{390625}}{{1679616}}\right){+}{4}{}{{\mathrm{ln}}{}\left({5}\right)}^{{2}}{+}{4}{}{{\mathrm{ln}}{}\left({3}\right)}^{{2}}{+}{{\mathrm{σ}}}^{{4}}{+}{4}{}{d}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{r}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{{d}}^{{2}}{-}{8}{}{d}{}{r}{+}{4}{}{{r}}^{{2}}}{{{\mathrm{σ}}}^{{2}}}}{}\sqrt{{2}}{-}{6}{}{{ⅇ}}^{{-}\frac{{1}}{{8}}{}\frac{{{\mathrm{σ}}}^{{2}}{}{\mathrm{ln}}{}\left(\frac{{1296}}{{625}}\right){+}{4}{}{{\mathrm{ln}}{}\left({2}\right)}^{{2}}{+}{\mathrm{ln}}{}\left({5}\right){}{\mathrm{ln}}{}\left(\frac{{1}}{{256}}\right){+}{\mathrm{ln}}{}\left(\frac{{2}}{{5}}\right){}{\mathrm{ln}}{}\left({6561}\right){+}{d}{}{\mathrm{ln}}{}\left(\frac{{1679616}}{{390625}}\right){+}{r}{}{\mathrm{ln}}{}\left(\frac{{390625}}{{1679616}}\right){+}{4}{}{{\mathrm{ln}}{}\left({5}\right)}^{{2}}{+}{4}{}{{\mathrm{ln}}{}\left({3}\right)}^{{2}}{+}{{\mathrm{σ}}}^{{4}}{+}{4}{}{d}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{r}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{{d}}^{{2}}{-}{8}{}{d}{}{r}{+}{4}{}{{r}}^{{2}}}{{{\mathrm{σ}}}^{{2}}}}{}\sqrt{{2}}}{\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}}$ (6)
 > $\mathrm{BlackScholesDelta}\left(100,120,1,0.3,0.05,0.03,'\mathrm{put}'\right)$
 ${-}{0.632854644}$ (7)
 > $\mathrm{BlackScholesDelta}\left(100,t→\mathrm{max}\left(120-t,0\right),1,\mathrm{σ},r,d\right)$
 ${-}\frac{{1}}{{10}}{}\frac{{{ⅇ}}^{{-}{r}{-}{d}}{}\left({5}{}{{ⅇ}}^{{r}}{}{\mathrm{erf}}{}\left(\frac{{1}}{{4}}{}\frac{\left({2}{}{\mathrm{ln}}{}\left(\frac{{6}}{{5}}\right){-}{{\mathrm{σ}}}^{{2}}{+}{2}{}{d}{-}{2}{}{r}\right){}\sqrt{{2}}}{{\mathrm{σ}}}\right){}\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}{-}{5}{}{{ⅇ}}^{{-}\frac{{1}}{{8}}{}\frac{{{\mathrm{σ}}}^{{2}}{}{\mathrm{ln}}{}\left(\frac{{625}}{{1296}}\right){+}{4}{}{{\mathrm{ln}}{}\left({2}\right)}^{{2}}{+}{\mathrm{ln}}{}\left({5}\right){}{\mathrm{ln}}{}\left(\frac{{1}}{{256}}\right){+}{\mathrm{ln}}{}\left(\frac{{2}}{{5}}\right){}{\mathrm{ln}}{}\left({6561}\right){+}{d}{}{\mathrm{ln}}{}\left(\frac{{1679616}}{{390625}}\right){+}{r}{}{\mathrm{ln}}{}\left(\frac{{390625}}{{1679616}}\right){+}{4}{}{{\mathrm{ln}}{}\left({5}\right)}^{{2}}{+}{4}{}{{\mathrm{ln}}{}\left({3}\right)}^{{2}}{+}{{\mathrm{σ}}}^{{4}}{-}{4}{}{d}{}{{\mathrm{σ}}}^{{2}}{-}{4}{}{r}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{{d}}^{{2}}{-}{8}{}{d}{}{r}{+}{4}{}{{r}}^{{2}}}{{{\mathrm{σ}}}^{{2}}}}{}\sqrt{{2}}{+}{5}{}{{ⅇ}}^{{r}}{}\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}{+}{6}{}{{ⅇ}}^{{-}\frac{{1}}{{8}}{}\frac{{{\mathrm{σ}}}^{{2}}{}{\mathrm{ln}}{}\left(\frac{{1296}}{{625}}\right){+}{4}{}{{\mathrm{ln}}{}\left({2}\right)}^{{2}}{+}{\mathrm{ln}}{}\left({5}\right){}{\mathrm{ln}}{}\left(\frac{{1}}{{256}}\right){+}{\mathrm{ln}}{}\left(\frac{{2}}{{5}}\right){}{\mathrm{ln}}{}\left({6561}\right){+}{d}{}{\mathrm{ln}}{}\left(\frac{{1679616}}{{390625}}\right){+}{r}{}{\mathrm{ln}}{}\left(\frac{{390625}}{{1679616}}\right){+}{4}{}{{\mathrm{ln}}{}\left({5}\right)}^{{2}}{+}{4}{}{{\mathrm{ln}}{}\left({3}\right)}^{{2}}{+}{{\mathrm{σ}}}^{{4}}{-}{4}{}{d}{}{{\mathrm{σ}}}^{{2}}{-}{4}{}{r}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{{d}}^{{2}}{-}{8}{}{d}{}{r}{+}{4}{}{{r}}^{{2}}}{{{\mathrm{σ}}}^{{2}}}}{}\sqrt{{2}}\right)}{\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}}$ (8)
 > $\mathrm{BlackScholesDelta}\left(100,t→\mathrm{max}\left(120-t,0\right),1,0.3,0.05,0.03,d\right)$
 ${-}{0.6328546388}$ (9)

In this example, you will compute the Delta of a strangle.

 > $S≔\mathrm{BlackScholesDelta}\left(100,t→\mathrm{piecewise}\left(t<50,50-t,t<100,0,t-100\right),1,\mathrm{σ},r,d\right)$
 ${S}{≔}{-}\frac{{1}}{{4}}{}\frac{{{ⅇ}}^{{-}{r}{-}{d}}{}\left({-}{2}{}{{ⅇ}}^{{r}}{}{\mathrm{erf}}{}\left(\frac{{1}}{{4}}{}\frac{\sqrt{{2}}{}\left({{\mathrm{σ}}}^{{2}}{+}{2}{}{\mathrm{ln}}{}\left({2}\right){-}{2}{}{d}{+}{2}{}{r}\right)}{{\mathrm{σ}}}\right){}\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}{+}{2}{}{{ⅇ}}^{{r}}{}{\mathrm{erf}}{}\left(\frac{{1}}{{4}}{}\frac{\left({-}{{\mathrm{σ}}}^{{2}}{+}{2}{}{d}{-}{2}{}{r}\right){}\sqrt{{2}}}{{\mathrm{σ}}}\right){}\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}{-}{2}{}\sqrt{{2}}{}{{ⅇ}}^{{-}\frac{{1}}{{8}}{}\frac{{{\mathrm{σ}}}^{{2}}{}{\mathrm{ln}}{}\left({16}\right){+}{4}{}{{\mathrm{ln}}{}\left({2}\right)}^{{2}}{+}{d}{}{\mathrm{ln}}{}\left(\frac{{1}}{{256}}\right){+}{r}{}{\mathrm{ln}}{}\left({256}\right){+}{{\mathrm{σ}}}^{{4}}{-}{4}{}{d}{}{{\mathrm{σ}}}^{{2}}{-}{4}{}{r}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{{d}}^{{2}}{-}{8}{}{d}{}{r}{+}{4}{}{{r}}^{{2}}}{{{\mathrm{σ}}}^{{2}}}}{+}{{ⅇ}}^{{-}\frac{{1}}{{8}}{}\frac{{{\mathrm{σ}}}^{{2}}{}{\mathrm{ln}}{}\left(\frac{{1}}{{16}}\right){+}{4}{}{{\mathrm{ln}}{}\left({2}\right)}^{{2}}{+}{d}{}{\mathrm{ln}}{}\left(\frac{{1}}{{256}}\right){+}{r}{}{\mathrm{ln}}{}\left({256}\right){+}{{\mathrm{σ}}}^{{4}}{-}{4}{}{d}{}{{\mathrm{σ}}}^{{2}}{-}{4}{}{r}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{{d}}^{{2}}{-}{8}{}{d}{}{r}{+}{4}{}{{r}}^{{2}}}{{{\mathrm{σ}}}^{{2}}}}{}\sqrt{{2}}\right)}{\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}}$ (10)
 > $C≔\mathrm{BlackScholesDelta}\left(100,100,1,\mathrm{σ},r,d,'\mathrm{call}'\right)$
 ${C}{≔}{-}\frac{{1}}{{2}}{}{{ⅇ}}^{{-}{d}}{}\left({\mathrm{erf}}{}\left(\frac{{1}}{{4}}{}\frac{\left({-}{{\mathrm{σ}}}^{{2}}{+}{2}{}{d}{-}{2}{}{r}\right){}\sqrt{{2}}}{{\mathrm{σ}}}\right){-}{1}\right)$ (11)
 > $P≔\mathrm{BlackScholesDelta}\left(100,50,1,\mathrm{σ},r,d,'\mathrm{put}'\right)$
 ${P}{≔}{-}\frac{{1}}{{4}}{}\frac{{-}{2}{}{{ⅇ}}^{{-}{d}}{}{\mathrm{erf}}{}\left(\frac{{1}}{{4}}{}\frac{\sqrt{{2}}{}\left({{\mathrm{σ}}}^{{2}}{+}{2}{}{\mathrm{ln}}{}\left({2}\right){-}{2}{}{d}{+}{2}{}{r}\right)}{{\mathrm{σ}}}\right){}\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}{+}{2}{}{{ⅇ}}^{{-}{d}}{}\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}{+}{{ⅇ}}^{{-}\frac{{1}}{{8}}{}\frac{{{\mathrm{σ}}}^{{2}}{}{\mathrm{ln}}{}\left(\frac{{1}}{{16}}\right){+}{4}{}{{\mathrm{ln}}{}\left({2}\right)}^{{2}}{+}{d}{}{\mathrm{ln}}{}\left(\frac{{1}}{{256}}\right){+}{r}{}{\mathrm{ln}}{}\left({256}\right){+}{{\mathrm{σ}}}^{{4}}{+}{4}{}{d}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{r}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{{d}}^{{2}}{-}{8}{}{d}{}{r}{+}{4}{}{{r}}^{{2}}}{{{\mathrm{σ}}}^{{2}}}}{}\sqrt{{2}}{-}{2}{}\sqrt{{2}}{}{{ⅇ}}^{{-}\frac{{1}}{{8}}{}\frac{{{\mathrm{σ}}}^{{2}}{}{\mathrm{ln}}{}\left({16}\right){+}{4}{}{{\mathrm{ln}}{}\left({2}\right)}^{{2}}{+}{d}{}{\mathrm{ln}}{}\left(\frac{{1}}{{256}}\right){+}{r}{}{\mathrm{ln}}{}\left({256}\right){+}{{\mathrm{σ}}}^{{4}}{+}{4}{}{d}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{r}{}{{\mathrm{σ}}}^{{2}}{+}{4}{}{{d}}^{{2}}{-}{8}{}{d}{}{r}{+}{4}{}{{r}}^{{2}}}{{{\mathrm{σ}}}^{{2}}}}}{\sqrt{{\mathrm{π}}}{}{\mathrm{σ}}}$ (12)

Check:

 > $\mathrm{simplify}\left(S-C-P\right)$
 ${0}$ (13)

References

 Hull, J., Options, Futures, and Other Derivatives, 5th. edition. Upper Saddle River, New Jersey: Prentice Hall, 2003.

Compatibility

 • The Finance[BlackScholesDelta] command was introduced in Maple 15.