Appendix: Some Source Codes

In VBA, (Visual Basic for Application) the code for a European call with the binomial model can be written as:

Function eCall(S, K, T, r, sigma, n) u ¼ Exp(sigma*((T/n)^0.5)) d ¼ 1/u r ¼ Exp(r*(T/n)) rp_u ¼ (r - d)/(r*(u - d)) rp_d ¼ 1/r - rp_u eCall ¼ 0

For i ¼ 0Ton eCall ¼ eCall + Application.Combin(n, i)*rp_u^i*rp_d^(n - i)* _ Application.Max(S*u^i*d^(n - i) - K, 0) Next i End Function

A more general binomial model, which also handles American-type options, is given below. This code is written in VBA and handles some of the binomial models such as Cox–Ross–Rubenstein (with and without Black–Scholes smoothing) and the Leisen–Reimer model. The model also calculates the , delta, gamma and theta. To calculate rho and vega, two trees must be made with two different interest rates and volatilities, respectively

© The Author(s) 2017 461 J.R.M. Röman, Analytical Finance: Volume I, DOI 10.1007/978-3-319-34027-2 462 Appendix: Some Source Codes

’ Input mBin ¼ Binomial model ’ mExe ¼ Put or Call (PUT_ or CALL_) ’ mTyp ¼ American or European

Function Binom(mBin As , mTyp As Long, mExe As Long, S As Double, X As Double, T As Double, r As Double, v As Double, n As Long, mDelta As Double, mGamma As Double, mTheta As Double) Dim d1 As Double, d2 As Double, a As Double, b As Double Dim aa As Double, vv As Double, U As Double, D As Double Dim udd As Double, u_d As Double, p As Double, Dt As Double Dim disc As Double, pe As Double, my As Double, m As Double Dim q As Double, ermqdt As Double, pdash As Double, ans As Double Dim idx As Long, i As Long, j As Long Dim lSt1(0 To 2) As Double Dim lC1(0 To 2) As Double ReDim lSt(0 To n + 2) As Double ReDim lC(0 To n + 2) As Double

d1 ¼ (Log(S / X) + (r +v*v/2)*T)/(v*Sqr(T)) d2 ¼ d1 - v * Sqr(T) Dt ¼ T/n disc ¼ Exp(-r * Dt)

If (mBin ¼ CRR) Then U ¼ Exp(v * Sqr(Dt)) D ¼ 1/U udd ¼ U/D u_d ¼ U-D p ¼ (1 / disc - D) / u_d ElseIf (mBin ¼ PEG) Then pe ¼ (Log(X / S)) / n U ¼ Exp(pe + v * Sqr(Dt)) D ¼ Exp(pe - v * Sqr(Dt)) udd ¼ U/D u_d ¼ U-D p ¼ (1 / disc - D) / u_d ElseIf (mBin ¼ JR) Then ’ Remark pu ¼ pd ¼ 0.5! ’ In this method the calc. of delta and gamma (rho+) is more ’ difficult since S0 <> S0*u*d. Use ORC method in this case! my ¼ r-0.5*v*v U ¼ Exp(my * Dt + v * Sqr(Dt)) D ¼ Exp(my * Dt - v * Sqr(Dt)) p ¼ 0.5 udd ¼ U/D u_d ¼ U-D Appendix: Some Source Codes 463

ElseIf (mBin ¼ TIAN) Then m ¼ Exp(r * Dt) vv ¼ Exp(v *v*Dt) U ¼ 0.5*m*vv*(1+vv+Sqr(vv * vv +2*vv-3)) D ¼ 0.5*m*vv*(1+vv-Sqr(vv * vv +2*vv-3)) udd ¼ U/D u_d ¼ U-D p ¼ (1 / disc - D) / u_d ElseIf (mBin ¼ LR) Then q ¼ 0 ’ No yield ermqdt ¼ Exp((r - q) * Dt) d2 ¼ BSDTwo(S, X, r, q, T, v) p ¼ PPNormInv(d2, n) pdash ¼ PPNormInv(d2 + v * Sqr(T), n) U ¼ ermqdt * pdash / p D ¼ ermqdt * (1 - pdash) / (1 - p) udd ¼ U/D u_d ¼ U-D End If

’ initialize prices at maturity log(a^b) ¼ b*log(a) lSt(0) ¼ S*D^n

For i ¼ 1Ton lSt(i) ¼ lSt(i - 1) * udd Next i

’ initialize option prices at maturity n For i ¼ 0Ton lC(i) ¼ Max(0, bC(mExe, lSt(i), X)) Next i idx ¼ find_opt_index(lSt, X, n)

’ step back through the tree For j ¼ n-1To2Step -1 For i ¼ 0Toj lC(i) ¼ disc * (p * lC(i + 1) + (1 - p) * lC(i)) lSt(i) ¼ lSt(i) / D If (mTyp ¼ AMERICAN) Then lC(i) ¼ Max(lC(i), bC(mExe, lSt(i), X)) End If If (BS_Smoothing) Then If (j ¼ n - 1) Then If (i >¼ idx And i <¼ idx + 4) Then 464 Appendix: Some Source Codes

lC(i) ¼ GBlackScholes(mExe, lSt(i), X, T / n, r, r, v) End If End If End If Next i Next j

’ save option value, used for calculating parameters mTheta ¼ lC(1) / Dt ’ For calculating Theta.

For i ¼ 0To1 lC1(i) ¼ disc * (p * lC(i + 1) + (1 - p) * lC(i)) lSt1(i) ¼ lSt(i) / D

If (mTyp ¼ AMERICAN) Then lC1(i) ¼ Max(lC1(i), bC(mExe, lSt1(i), X)) End If Next i

ans ¼ disc * (p * lC1(1) + (1 - p) * lC1(0)) If (mTyp ¼ AMERICAN) Then ans ¼ Max(ans, bC(mExe, S, X))

mGamma ¼ ((lC(2) - lC(1)) / (lSt(2) - lSt(1)) - _ (lC(1) - lC(0)) / (lSt(1) - lSt(0))) / (0.5 * (lSt(2) - lSt(0))) mDelta ¼ (lC1(1) - lC1(0)) / (lSt1(1) - lSt1(0)) mTheta ¼ (mTheta - ans / Dt) / 2 If (mBin ¼ TIAN) Then mTheta ¼ mTheta / 2 Binom ¼ ans End Function

To find the index closest to the strike for the Black–Scholes smoothing, we use the following function:

Function find_opt_index(lSt() As Double, mX As Double, n As Long) Dim idx As Long, i As Long

idx ¼ 0

For i ¼ 0Ton-1 If (lSt(i) >¼ mX) Then Exit For idx ¼ idx + 1 Next i find_opt_index ¼ idx - 2 End Function Appendix: Some Source Codes 465

The boundary for call and put, is given by:

Function bC(aIsCall As Long, S As Double, X As Double) As Double If aIsCall Then bC ¼ S-X Else bC ¼ X-S End If End Function

We also use two functions from the Black–Scholes model:

Function BSDTwo(S As Double, X As Double, r As Double, q As Double, _ T As Double, v As Double) As Double BSDTwo ¼ (Log(S/X)+(r-q-0.5*v*v)*T)/(v*Sqr(T)) End Function double BSDTwo(double S, double X, double r, double q, double T,

Function BlackScholes(mCall As Long, S As Double, X As Double, _ T As Double, r As Double, b As Double, _ v As Double) As Double Dim d1 As Double, d2 As Double

d1 ¼ (Log(S / X) + (b +v*v/2)*T)/(v*Sqr(T)) d2 ¼ d1 - v * Sqr(T)

If (mCall) Then BlackScholes ¼ S*Exp((b - r) * T)*CND(d1) - X*Exp(-r*T)*CND(d2) Else BlackScholes ¼ X*Exp(-r*T)*CND(-d2) - S*Exp((b - r)*T)*CND(-d1) End If End Function

In the Leisen–Reimer model we use the Peizer–Pratt inversion formula:

Function PPNormInv(z As Double, n As Long) As Double Dim c1 As Double

n ¼ 2 * Int(n / 2) + 1 ’ ¼¼ odd(n); c1 ¼ Exp(-((z / (n +1/3+0.1/(n+1))) * _ (z/(n+1/3+0.1/(n+1)))) * (n +1/6)) PPNormInv ¼ 0.5 + Sgn(z) * Sqr((0.25 * (1 - c1))) End Function 466 Appendix: Some Source Codes

The function CND to calculate the cumulative normal eistribution is given in VBA below. This function below gives the normal distribution function À with a maximum error of 10 8: do Function CND(X As Double) As Double Dim sign As Long Dim x2, q0, q1, q2 As Double

If (X < 0) Then X ¼ -X sign ¼ -1 ElseIf (X > 0) Then sign ¼ 1 Else ’ (x ¼ 0.0) CND ¼ 0.5 Exit Function End If

If (X > 20) Then If (sign < 0) Then CND ¼ 0 Else CND ¼ 1 End If Exit Function End If

X ¼ X*0.707106781186547 x2 ¼ X*X If (X < 0.46875) Then q1 ¼ 3209.37758913847 + x2*(377.485237685302 + x2* _ (113.86415415105 + x2*(3.16112374387057 + x2* _ 0.185777706184603)))

q2 ¼ 2844.23683343917 + x2*(1282.61652607737 + x2* _ (244.024637934444 + x2*(23.6012909523441 + x2))) CND ¼ 0.5*(1 + sign*X*q1/q2) ElseIf (X < 4) Then q1 ¼ X*(8.88314979438838 + X*(0.56418849698867 + X* _ 2.15311535474404E-08)) q1 ¼ X*(881.952221241769 + X*(298.6351381974 + X* _ (66.1191906371416 + q1))) q1 ¼ 1230.339354798 + X*(2051.07837782607 + X*(1712.04761263407 _ + q1)) Appendix: Some Source Codes 467

q2 ¼ X*(117.693950891312 + X * (15.7449261107098 + X)) q2 ¼ X*(3290.79923573346 + X*(1621.38957456669 + X* _ (537.18110186201 + q2))) q2 ¼ 1230.33935480375 + X*(3439.36767414372 + X* _ (4362.61909014325 + q2))

CND ¼ 0.5*(1 + sign*(1 - Exp(-x2)*q1/q2)) Else q0 ¼ 1/x2 q1 ¼ 6.58749161529838E-04 + q0*(1.60837851487423E-02 + q0* _ (0.125781726111229 + q0*(0.360344899949804 + q0* _ (0.305326634961232 + q0*1.63153871373021E-02))))

q2 ¼ 2.33520497626869E-03 + q0*(6.05183413124413E-02 + q0* _ (0.527905102951428 + q0*(1.87295284992346 + q0*´_ (2.56852019228982 + q0)))) CND ¼ 0.5*(1 + sign*(1 - Exp(-x2)/X*(0.564189583547756 - _ q0*q1/q2))) End If End Function

Function nd(X As Double) As Double nd ¼ 1/Sqr(2*3.141592654)*Exp(-X*X/2) End Function

Below we give an example of how to write a C++ program to solve option prices with the Crank–Nicholson method. The model also calculates the Greeks, delta, gamma and theta. To calculate rho and vega, two grids must be made with two different interest rates and volatilities, respectively, The function bC is the same as for the binomial model. double CrNi(double S, double K, double T, double sig, double r, int N, int Nj, double div, int mIsCall, int mIsAmerican, double D, double &mDelta, double &mGamma, double &mTheta) { double dt ¼ T/N; double dx ¼ sig*sqrt(D*dt); double nu ¼ r - div - 0.5*sig*sig; double edx ¼ exp(dx); double pu ¼ -0.25*dt*((sig/dx)*(sig/dx) + nu/dx); double pm ¼ 1.0 + 0.5*dt*(sig/dx)*(sig/dx) + 0.5*r*dt; 468 Appendix: Some Source Codes

double pd ¼ -0.25*dt*((sig/dx)*(sig/dx) - nu/dx); double *St, *C[2], lambda_U, lambda_L;

St ¼ new double [2*Nj + 3]; C[0] ¼ new double [2*Nj + 3]; C[1] ¼ new double [2*Nj + 3];

// Initialize the asset prices at maturity. St[0] ¼ S*exp(-Nj*dx); for (int j ¼ 1; j <¼ 2*Nj; j++) { St[j] ¼ edx*St[j-1]; }

// Initialize the option values at maturity. for (int j ¼ 0; j <¼ 2*Nj; j++) C[0][j] ¼ max(0.0, bC(mIsCall, St[j], K));

// Compute boundary condition if (mIsCall) { lambda_U ¼ St[2*Nj] - St[2*Nj-1]; lambda_L ¼ 0.0; } else { lambda_L ¼ -(St[1] - St[0]); lambda_U ¼ 0.0; }

// Step backwards through the lattice for (int i ¼ N-1;i>¼ 0; i--) { solve_CN(C, pu, pm, pd, lambda_L, lambda_U, Nj); if (i ¼¼ 0) mTheta ¼ (C[0][Nj] - C[1][Nj])/dt;

// Apply early condition for (int j ¼ 0; j <¼ 2*Nj; j++) { if (mIsAmerican) C[0][j] ¼ max(C[1][j], bC(mIsCall, St[j], K)); else C[0][j] ¼ C[1][j]; } } Appendix: Some Source Codes 469

mDelta ¼ (C[1][Nj+1] - C[1][Nj-1])/(St[Nj+1] - St[Nj-1]); mGamma ¼ ((C[0][Nj+2] - C[0][Nj]) /(St[Nj+2] - St[Nj]) - (C[0][Nj] - C[0][Nj-2])/(St[Nj] - St[Nj-2]))/ (0.5*(St[Nj+2] - St[Nj-2]));

return C[0][Nj]; } double solve_CN(double **C, double pu, double pm, double pd, double lambda_L, double lambda_U, int Nj) { double *pmp; // ¼ array(); double *pp; // ¼ array();

pp ¼ new double [2*Nj + 3]; pmp ¼ new double [2*Nj + 3];

// Substitute boundary condition at j ¼ -Nj into j ¼ -Nj + 1 pmp[1] ¼ pm + pd; pp [1] ¼ -pu*C[0][2] - (pm - 2.0)*C[0][1] – pd*C[0][0] + pd*lambda_L;

// Eliminate the upper diagonal for (int j ¼ 2; j < 2*Nj; j++) { pmp[j] ¼ pm - pu*pd/pmp[j-1]; pp [j] ¼ - pu*C[0][j+1] - (pm - 2.0)*C[0][j] - pd*C[0][j-1] - pp[j-1]*pd/pmp[j-1]; }

// Use boundary condition at j ¼ Nj and equation at j ¼ Nj - 1 C[1][2*Nj] ¼ (pp[2*Nj-1] + pmp[2*Nj-1]*lambda_U)/ (pu + pmp[2*Nj-1]); C[1][2*Nj-1] ¼ C[1][2*Nj] - lambda_U;

// Back substitution for (int j ¼ 2*Nj - 2; j >¼ 1; j--) C[1][j] ¼ (pp[j] - pu*C[1][j+1])/pmp[j];

C[1][0] ¼ C[1][1] - lambda_L; delete [] pp; delete [] pmp; } A VBA code for the Black–Scholes model (i.e., with continuous ) and the Greeks are given below: 470 Appendix: Some Source Codes

Function BlackScholes(mCall As Integer, s As Double, x As Double, _ T As Double, r As Double, b As Double, _ v As Double) As Double Dim d1 As Double, d2 As Double

d1 ¼ (Log(s/x) + (b + v*v/2)* T)/(v*Sqr(T)) d2 ¼ d1 - v * Sqr(T)

if (mCall) Then if (T > 0.0) BlackScholes ¼ s*Exp((b - r)*T)*CND(d1) - x*Exp(-r * T)*CND(d2) Else BlackScholes ¼ WorksheetFunction.Max(s - x, 0) Else if (T > 0.0) BlackScholes ¼ x*Exp(-r*T)*CND(-d2) - s*Exp((b - r)*T)*CND(-d1) Else BlackScholes ¼ WorksheetFunction.Max(x - s, 0) End Function

Function Delta(mCall As Integer, s As Double, x As Double, _ T As Double, r As Double, b As Double, _ v As Double) As Double Dim d1 As Double

If (T > 0) Then d1 ¼ (Log(s/x) + (b + v*v/2)*T)/(v*Sqr(T)) Else d1 ¼ (Log(s/x) + (b + v*v/2)*T)/(v*Sqr(T))

If (mCall) Then Delta ¼ Exp((b - r)*T)*CND(d1) Else Delta ¼ Exp((b - r)*T)*(CND(d1) - 1) End If End Function

Function Gamma(s As Double, x As Double, T As Double, _ r As Double, b As Double, v As Double) As Double Dim d1 As Double

d1 ¼ (Log(s/x) + (b + v*v/2)*T)/(v*Sqr(T)) Gamma ¼ nd(d1)*Exp((b - r)*T)/(s*v*Sqr(T)) End Function Appendix: Some Source Codes 471

Function Vega(s As Double, x As Double, T As Double, r As Double,_ b As Double, v As Double) As Double Dim d1 As Double

d1 ¼ (Log(s/x) + (b + v*v/2)*T)/(v*Sqr(T)) Vega ¼ s*Exp((b - r)*T)*nd(d1)*Sqr(T) End Function

Function Theta(mCall As Integer, s As Double, x As Double, _ T As Double, r As Double, b As Double, _ v As Double) As Double Dim d1 As Double Dim d2 As Double

d1 ¼ (Log(s/x) + (b + v*v/2)*T)/(v*Sqr(T)) d2 ¼ d1 - v*Sqr(T)

If (mCall) Then Theta ¼ -s*Exp((b - r)*T)*nd(d1)*v/(2*Sqr(T)) – _ (b - r)*s*Exp((b - r)*T)*CND(d1) - r*x*Exp(-r*T)*CND(d2) Else Theta ¼ -s*Exp((r - b)*T)*nd(d1)*v/(2*Sqr(T)) + _ (b - r)*s*Exp((b - r)*T)*CND(-d1) + r*x*Exp(-r*T)*CND(-d2) End If End Function

Function Rho(mCall As Integer, s As Double, x As Double, _ T As Double, r As Double, b As Double, _ v As Double) As Double Dim d1 As Double Dim d2 As Double

d1 ¼ (Log(s/x) + (b + v*v/2)*T)/(v*Sqr(T)) d2 ¼ d1 - v*Sqr(T)

If (mCall) Then If (b ¼ 0) Then Rho ¼ -T*BlackScholes(1, s, x, T, r, b, v) Else Rho ¼ T*x*Exp(-r*T)*CND(d2) End If Else If (b ¼ 0) Then Rho ¼ -T*BlackScholes(0, s, x, T, r, b, v) Else 472 Appendix: Some Source Codes

Rho ¼ -T*x*Exp(-r*T)*CND(-d2) End If End If End Function

A VBA implementation of the RollGeske–Whaley model is given below

Public Const BIGNUM As Long ¼ 100000000 Public Const EPSILON As Double ¼ 0.00001

Function RollGeskeWhaley(s As Double, x As Double, v As Double, _ r As Double, T As Double, D As Double, _ TD As Double) As Double Dim SX As Double, ci As Double, HighS As Double, LowS As Double Dim a1 As Double, a2 As Double, b1 As Double, b2 As Double, Dim c As Double, i As Double

SX ¼ s-D*Exp(-r * TD)

’ Not optimal to exercise..... If (D <¼ x*(1 - Exp(-r*(T - TD)))) Then RollGeskeWhaley ¼ BlackScholes(mCall, SX, x, T, r, r, v) Exit Function End If ci ¼ BlackScholes(mCall, SX, x, T - TD, r, r, v) HighS ¼ s

Do While ((ci - HighS -D+x)> 0 And (HighS < BIGNUM)) HighS ¼ 2*HighS ci ¼ BlackScholes(mCall, HighS, x, T - TD, r, r, v) Loop

If (HighS < BIGNUM) Then RollGeskeWhaley ¼ BlackScholes(mCall, SX, x, T, r, r, v) Exit Function End If

LowS ¼ 0 i ¼ HighS * 0.5 ci ¼ BlackScholes(mCall, i, x, T - TD, r, r, v)

’ Find the critical Stock Price with Bisection. Do While (Abs(ci - i -D+x)> EPSILON And _ (HighS - LowS) > EPSILON) Appendix: Some Source Codes 473

If ((ci -i-D+x)< 0) Then HighS ¼ i Else LowS ¼ i End If

i ¼ (HighS + LowS)/2 ci ¼ BlackScholes(mCall, i, x, T - TD, r, r, v) Loop

a1 ¼ (Log(SX/x) + (r + v*v/2)*T)/(v*Sqr(T)) a2 ¼ a1 - v*Sqr(T) b1 ¼ (Log(SX/i) + (r + v*v/2)*TD)/(v*Sqr(TD)) b2 ¼ b1 - v*Sqr(TD)

c ¼ SX*(CND(b1) + M(a1, -b1, Sqr(TD / T))) - _ x*Exp(-r*T)*M(a2, -b2, -Sqr(TD/T)) – _ (x - D)*Exp(-r*TD)*CND(b2) RollGeskeWhaley ¼ c End Function

Where the function for the bivariate normal distribution is given below. The bivariate normal distribution is defined as: () ÀÁÀÁ2 1 ðÞx À μ 2 2λðÞx À μ y À μ y À μ MxðÞ¼; y; λ pffiffiffiffiffiffiffiffiffiffiffiffiffi exp x À x y þ y ; 2 σ2 σ σ σ2 2πσxσy 1 À λ x x y y

μ μ σ σ where x and y is the mean of x and y, x and y the standard deviations. The correlation function λ is defined by σ λ ¼ corrðÞ¼x; y xy : σxσy

Hereby, the probability measure p(x, y) is given by ðx ðy pxðÞ¼; y f ðÞξ; ζ; λ dξdζ:

À1 À1

A VBA implementation is given below 474 Appendix: Some Source Codes

’ Calculates the Cumulative Probability in Bivariate Normal dist. ’ with |e(x)| < 1.0e-7

Function M(a As Double, b As Double, c As Double) As Double Dim sa As Double, sb As Double, r1 As Double, r2 As Double Dim D As Double

sa ¼ 1 sb ¼ 1

If (a <¼ 0 And b <¼ 0 And c <¼ 0) Then M ¼ MM(a, b, c) ElseIf (a*b*c <¼ 0) Then If (b > 0 And c > 0) Then M ¼ CND(a) - MM(a, -b, -c) ElseIf (a > 0 And c > 0) Then M ¼ CND(b) - MM(-a, b, -c) ElseIf (a > 0 And b > 0) Then M ¼ CND(a) + CND(b) - 1 - MM(-a, -b, c) End If Else If (a < 0) Then sa ¼ -1 If (b < 0) Then sb ¼ -1 r1 ¼ (c*a - b)*sa/Sqr(a*a - 2*a*b*c + b*b) r2 ¼ (c*b - a)*sb/Sqr(a*a - 2*a*b*c + b*b) D ¼ (1 - sa*sb)/4 M ¼ MM(a, 0, r1) + MM(b, 0, r2) - D End If End Function

Function MM(a As Double, b As Double, c As Double) As Double Dim aa As Double, bb As Double Dim i As Integer, j As Integer Dim am(4) As Double Dim bm(4) As Double

am(0) ¼ 0.325303 am(1) ¼ 0.4211071 am(2) ¼ 0.1334425 am(3) ¼ 0.006374323

bm(0) ¼ 0.1337764 bm(1) ¼ 0.6243247 bm(2) ¼ 1.3425378 bm(3) ¼ 2.2626645 Appendix: Some Source Codes 475

MM ¼ 0 aa ¼ a/Sqr(2*(1 - c*c)) bb ¼ b/Sqr(2*(1 - c*c))

For i ¼ 0To4 For j ¼ 0To4 MM ¼ MM + am(i)*am(j)*f(bm(i), bm(j), aa, bb, c) Next j Next i MM ¼ MM*Sqr(1 - c*c)/3.121592654 End Function

Function f(x As Double, y As Double, a As Double, b As Double, _ c As Double) As Double f ¼ Exp(a*(2*x - a) + b*(2*y - b) + 2*c*(x - a)*(y - b)) End Function

A VBA implementation of Barone–Adesi–Whaley is given below:

Function BaroneAdesiWhaleyCall(s As Double, x As Double, _ v As Double, r As Double, _ T As Double, b As Double) As Double Dim sk As Double, n As Double, K As Double, d1 As Double Dim q2 As Double, a2 As Double

If (b >¼ r) Then BaroneAdesiWhaleyCall ¼ BlackScholes(mCall, s, x, T, r, b, v) Exit Function End If

sk ¼ kc(x, T, r, b, v) n ¼ 2*b/(v*v) K ¼ 2*r/(v*v*(1 - Exp(-r*T))) d1 ¼ (Log(sk/x) + (b + v*v/2)*T)/(v*Sqr(T)) q2 ¼ (-(n - 1) + Sqr((n - 1)*(n - 1) + 4*K))/2 a2 ¼ (sk/q2)*(1 - Exp((b - r)*T)*CND(d1))

If (s < sk) Then BaroneAdesiWhaleyCall ¼ BlackScholes(mCall, s, x, T, r, b, v)_ + a2*(s/sk) ^ q2 Exit Function End If

BaroneAdesiWhaleyCall ¼ s-x End Function 476 Appendix: Some Source Codes

Function BaroneAdesiWhaleyPut(s As Double, x As Double, _ v As Double, r As Double, _ T As Double, b As Double) As Double Dim sk As Double, n As Double, K As Double, d1 As Double Dim q1 As Double, a1 As Double

sk ¼ kp(x, T, r, b, v) n ¼ 2*b/(v*v) K ¼ 2*r/(v*v*(1 - Exp(-r*T))) d1 ¼ (Log(sk/x) + (b + v*v/2)*T)/(v*Sqr(T)) q1 ¼ (-(n - 1) - Sqr((n - 1)*(n - 1) + 4*K))/2 a1 ¼ -(sk/q1)*(1 - Exp((b - r)*T)*CND(-d1))

If (s > sk) Then BaroneAdesiWhaleyPut ¼ BlackScholes(mPUT, s, x, T, r, b, v) _ + a1*(s/sk) ^ q1 Exit Function End If

BaroneAdesiWhaleyPut ¼ x-s End Function

Function kc(x As Double, T As Double, r As Double, b As Double, _ v As Double) As Double ’ Calculation of seed value, Si Dim M As Double, q2u As Double, Su As Double, h2 As Double Dim Si As Double, d1 As Double, q2 As Double, LHS As Double Dim RHS As Double, bi As Double, E As Double, K As Double

M ¼ 2*r/(v*v) q2u ¼ 1 + 2*M Su ¼ x/(1 - 1/q2u) h2 ¼ -(b*T + 2*v*Sqr(T))*x/(Su - x) Si ¼ x + (Su - x)*(1 - Exp(h2))

If (T ¼ 0) Then T ¼ 0.000000001 K ¼ 2*r/(v*v*(1 - Exp(-r*T))) d1 ¼ (Log(Si/x) + (b + v*v/2)*T)/(v*Sqr(T)) q2 ¼ 1 + 2*K LHS ¼ Si - x RHS ¼ BlackScholes(mCall, Si, x, T, r, b, v) + _ (1 - Exp((b - r)*T)*CND(d1))*Si/q2 bi ¼ Exp((b - r)*T)*CND(d1)*(1 - 1/q2) bi ¼ bi + (1 - Exp((b - r)*T)*CND(d1)/(v*Sqr(T)))/q2 E ¼ 0.000001 Appendix: Some Source Codes 477

’ Newton-Raphson algorithm for finding critical price Si Do While (Abs(LHS - RHS)/x > E) Si ¼ (x + RHS - bi*Si)/(1 - bi) d1 ¼ (Log(Si/x) + (b + v*v/2)*T)/(v*Sqr(T)) LHS ¼ Si - x RHS ¼ BlackScholes(mCall, Si, x, T, r, b, v) + _ (1 - Exp((b - r)*T)*CND(d1))*Si/q2 bi ¼ Exp((b - r)*T)*CND(d1)*(1 - 1/q2) bi ¼ bi + (1 - Exp((b - r)*T)*CND(d1)/(v*Sqr(T)))/q2 Loop kc ¼ Si End Function

Function kp(x As Double, T As Double, r As Double, b As Double, _ v As Double) As Double ’ Calculation of seed value, Si Dim M As Double, q1u As Double, Su As Double, h1 As Double Dim Si As Double, d1 As Double, q1 As Double, LHS As Double Dim RHS As Double, bi As Double Dim E As Double, K As Double, n As Double

n ¼ 2*b/(v*v) M ¼ 2*r/(v*v) q1u ¼ (-(n - 1) - Sqr((n - 1)*(n - 1) + 4*M))/2 Su ¼ x/(1 - 1/q1u) h1 ¼ (b*T - 2*v*Sqr(T))*x/(x - Su) Si ¼ Su + (x - Su)*Exp(h1)

If (T ¼ 0) Then T ¼ 0.000000001 K ¼ 2*r/(v*v*(1 - Exp(-r*T))) d1 ¼ (Log(Si/x) + (b + v*v/2)*T)/(v*Sqr(T)) q1 ¼ (-(n - 1) - Sqr((n - 1)*(n - 1) + 4*K))/2 LHS ¼ x-Si RHS ¼ BlackScholes(mPUT, Si, x, T, r, b, v) - _ (1 - Exp((b - r)*T)*CND(-d1))*Si/q1 bi ¼ -Exp((b - r)*T)*CND(-d1)*(1 - 1/q1) bi ¼ bi - (1 + Exp((b - r)*T)*CND(-d1)/(v*Sqr(T)))/q1 E ¼ 0.000001

’ Newton Raphson algorithm for finding critical price Si Do While (Abs(LHS - RHS)/x > E) Si ¼ (x - RHS + bi*Si)/(1 + bi) d1 ¼ (Log(Si/x) + (b + v*v/2)*T)/(v*Sqr(T)) LHS ¼ x-Si 478 Appendix: Some Source Codes

RHS ¼ BlackScholes(mPUT, Si, x, T, r, b, v) - _ (1 - Exp((b - r)*T)*CND(-d1))*Si/q1 bi ¼ -Exp((b - r)*T)*CND(-d1)*(1 - 1/q1) bi ¼ bi - (1 + Exp((b - r)*T)*CND(-d1)/(v*Sqr(T)))/q1 Loop kp ¼ Si End Function

A VBA implementation of the Bjerksund-Stensland model is given below:

Function BjerksundStenslandCall(s As Double, x As Double, _ v As Double, r As Double, _ T As Double, b As Double) _ As Double Dim Beta As Double, BInfinity As Double, B0 As Double Dim ht As Double, i As Double Dim alpha As Double, ss As Double

If (b >¼ r) Then // Never optimal to exersice before maturity BjerksundStenslandCall ¼ BlackScholes(mCall, s, x, T, r, b, v) Else Beta ¼ (0.5 - b/(v*v)) + Sqr((b/(v*v) - 0.5)*(b/(v*v) - 0.5)_ + 2*r/(v*v)) BInfinity ¼ Beta/(Beta - 1)*x B0 ¼ Max(x, r/(r - b)*x) ht ¼ -(b*T + 2*v*Sqr(T))*B0/(BInfinity - B0) i ¼ B0 + (BInfinity - B0)*(1 - Exp(ht)) alpha ¼ (i - x)*(i ^ (-Beta))

If (s >¼ i) Then BjerksundStenslandCall ¼ s-x Exit Function End If

ss ¼ alpha*(s^Beta) - alpha*phi(s, T, Beta, i, i, r, b, v) ss ¼ ss + (phi(s, T, 1, i, i, r, b, v) _ - phi(s, T, 1, x, i, r, b, v)) ss ¼ ss - (x*phi(s, T, 0, i, i, r, b, v) _ - x*phi(s, T, 0, x, i, r, b, v)) BjerksundStenslandCall ¼ ss End If End Function Appendix: Some Source Codes 479

Function BjerksundStenslandPut(s As Double, x As Double, v As Double, r As Double, _ T As Double, b As Double) As Double BjerksundStenslandPut ¼ _ BjerksundStenslandCall(x, s, v, r - b, T, -b) End Function

Function phi(s As Double, T As Double, gamma As Double, _ h As Double,_i As Double, r As Double, b As Double,_ v As Double) As Double Dim lambda As Double, D As Double, kappa As Double, f As Double

lambda ¼ (-r + gamma*b + 0.5*gamma*(gamma - 1)*(v*v))*T D ¼ -(Log(s/h) + (b + (gamma - 0.5)*(v*v))*T)/(v*Sqr(T)) kappa ¼ 2*b/((v*v)) + (2*gamma - 1) f ¼ CND(D) - ((i/s)^kappa)*CND(D - 2*Log(i/s)/(v*Sqr(T))) phi ¼ Exp(lambda)*(s^gamma)*f End Function References

Albanese, C., & Campolieti, G. (2006). Advanced derivatives pricing and risk manage- ment. San Diego: Elsevier Academic Press. Barone-Adesi, G., et.al. (1999). VaR without correlations for nonlinear portfolios. Journal of Futures Markets, 19, 583–602. Barucci, E. (2003). Financial markets theory. New York: Springer. Berkowitz, J., & O’Brien, J. (2002). How accurate are value-at-risk models at commercial banks? Journal of Finance, 57, 1093–1111. Björk, T. (1998). Arbitrage theory in continuous time. Oxford: Oxford University Press. Black, F. (1976). The pricing of commodity contracts. Journal of financial economics, 3 (1), 167–179. Black, F., & Scholes, M. (1973). The pricing of options and corporate liabilities. The Journal of Political Economy, 8, 637–654. Campbell, S. D. (2005). A review of backtesting and backtesting procedures. Finance and economics, discussion series Divisions of Research and Statistics and Monetary Affairs. Federal Reserve Board, Washington, DC. Clewlow, L., & Strickland, C. (2000). Implementing derivative models. London: Wiley. Conroy, R. M. (2003). Binomial option pricing. Darden Graduate School of Business Administration, University of Virginia. UVA-F-0943 Cox, J., Ross, S. A., & Rubenstein, M. (1979). Option pricing: A simplified approach. Journal of , 7(1979), 145–166. Curran, M. (1994). Valuing Asian and Portfolio options by conditioning on the geometric mean price. Management Science, 40(12), 1705–1711. Dana, R.-A., & Jeanblanc, M. (2007). Financial markets in continuous time. Berlin: Springer.

© The Author(s) 2017 481 J.R.M. Röman, Analytical Finance: Volume I, DOI 10.1007/978-3-319-34027-2 482 References

Davis, M., & Etheridge, A. (2006). Louis Bachelier’s theory of speculation: The origins of modern finance. Princeton: Princeton University Press. Derman, E. (1996). Model risk. Goldman Sachs Quantitative Strategies Research Notes. DeRosa, D. F. (2000). Options on foreign exchange. New York: Wiley. Drezner, Z. (1978). Computation of the bivariate normal integral. Mathematics of Computation, 32, 277–279. Glasserman, P. (2000). Monte Carlo methods in financial engineering. New York: Springer. Glasserman, P. (2003). Monte Carlo methods in financial engineering. New York: Springer. Glasserman, P. (2004). Monte Carlo methods in financial engineering. New York: Springer. Haug, E. (1997). The complete guide to option pricing formulas. New York: McGraw- Hill. Ho, T. S. Y., & Lee, S. B. (2005). Securities valuations. Oxford: Oxford University Press. Hull, J. Option futures and other derivatives. (9th Edition) Prentice-Hall. ISBN- 13: 978-0133456318 Hunt, P. J., & Kennedy, J. E. (2004). Financial derivative in theory and practise. Chichester: Wiley. Ingersoll, J. E. (1987). Theory of financial decision making. Totowa: Rowman & Littlefield. Jarrow, R., & Rudd, A. (1983). Option pricing (pp. 183–188). Homewood: Dow Jones-Irwin. Jorion, P. (2001). Value at risk: The new benchmark for managing financial risk. New York: McGraw-Hill. Kerry B. (2005). A cource in derivative securities. New York: Springer. Kijima, M. (2003). Stochastic processes with application to finance. London: Chapman & Hall. Kwok, Y.-K. (2008). Mathematical models of financial derivatives. New York: Springer. Leisen, D. (1998). Pricing the American : A detailed convergence analysis for binomial models. Journal of Economic Dynamics and Control, 22, 1419–1444. Leisen, D., & Reimer, M. (1996). Binomial models for option valuation – Examine and improving convergence. Applied , 3, 319–346. London, J. (2005). Modeling derivatives in C++. London: Wiley. Longstaff, F. A. (1989). Pricing options with extendible maturities. Journal of Finance, 45(3), 935–957. Martin, J. S. (2001). Applied math for derivatives. London: Wiley. Merton, R. C. (1973). Theory of rational option pricing. The Bell Journal of Economics and Management Science, 4(1), 141–183. Merton, C. R. (1976). Option pricing when stock returns are discontinuous. Journal of Financial Economics, 3, 167–179. References 483

Munk, C. (2003). analysis: Securities, pricing and risk management. http://citeseerx.ist.psu.edu/viewdoc/download?doi¼10.1.1.129.9912&rep¼rep1& type¼pdf Neftci, S. N. (2000). An introduction to the Mathematics of Financial Derivatives. New York: Academic Press. Neftci, S. N. (2004). Principles of financial engineering. San Diego: Academic Press. Pratt, J. W. (1968). A normal approximation for binomial, F, Beta, and other common, related tail probabilities, II. The Journal of the American Statistical Association, 63, 1457–1483. Rebonato, R. (2001). Managing model risk. In C. Alexander (Ed.), Handbook of risk management. FT-Prentice Hall. Reiner, E., & Rubinstein, M. (1991). Breaking down the barriers. Risk, 4,28–35. Rendleman, R. J., & Bartter, B. J. (1980). The pricing of options on debt securities. The Journal of Financial and Quantitative Analysis, 15, 11–24. Ross, S. M. (1983). Stochastic processes. New York: Wiley. Rubinstein, M. (2000). On the relation between binomial and trinomial option pricing models. The Journal of Derivatives, 8(2), 47–50. Schweizer, M. (2012). On Bermudan options. ETH Zurich. Shreve, Steven. (2004). Stochastic calculus for finance II. New York: Springer. Shreve, Steven. (2005). Stochastic calculus for finance I. New York: Springer. Sidenius, J. (2000). LIBOR market models in practice. Journal of Computational Finance, 3(3), 75–99. Stoklosa, J. (2007). Studies of barrier options and their sensitivities. The University of Melbourne. Tian, Y. (1993). A modified lattice approach to option pricing. Journal of Futures Markets, 13(5), 564–577. Trigeorgis, L. (1991). A log-transformed binomial numerical analysis for valuing complex multi-option investments. Journal of Financial and Quantitative Analysis, 26(3), 309–326. Wilmott, P. (2000). On quantitative finance. Chichester: Wiley. Index

A arbitrage strategy, 39, 271, 277 absolute continuous, 118 ARCH. See autoregressive conditional adapted, 96–100, 112, 205, 245, 249, heteroskedasticity (ARCH) 261, 268, 276–9 Arrow-Debreu, 360 all-or-nothing options, 293 Asian options, 29, 289, 312–19 American , 37, 48, 51, 229–35 asset-linked FX option, 334 American contract, 113, 233–5 asset-or-nothing options, 294, 296 American double-no-touch option, 301 atom, 95, 117 American knock-in option, 303 autocorrelation, 184 American knock-out option, 303 autoregression, 184 American no-touch option, 301, 302 autoregressive conditional American option, vii, viii, 29, 56, 62, heteroskedasticity (ARCH), 184–7 77, 113–17, 188, 212, 228–39, average price options, 312, 313, 315 296, 369 average strike options, 312 American put option, 48, 54–6, 61, 77, 218, 228–31 American style digital, 296 B arbitrage, vii, 21–3, 31–43, 92, 158, backwardation, 199 160–2, 196, 204, 211–15, 230–3, backward differences, 67, 69, 72 249, 255, 267–78, 282, 313, 329, BaroneÀAdesi, Whaley, 236–8, 475–8 337, 340, 359, 372, 380 barrier options, 289, 297–311 arbitrage condition, 38, 92, 211, 215 basket options, 327–32, 343 arbitrage portfolio, 31 benign barrier, 310

Note: Page numbers followed by “n” denote footnotes.

© The Author(s) 2017 485 J.R.M. Röman, Analytical Finance: Volume I, DOI 10.1007/978-3-319-34027-2 486 Index bet options, 293 caps, 15–18, 212, 342–4 better of options, 327 cash-or-nothing digital options, 297 big figure, 204 cash-or-nothing option(s), 289–94 binary options, 218, 292–8 Cauchy problem, 146 binomial distribution, 28, 48 CBOE SKEW Index, 454–8 binomial model(s), vii, 24, 29–39, CBOE Index® (VIX® Index), 43–64, 77, 91–3, 106–17, 265, 182, 452–9 308, 358, 461, 467 central limit theorem, 9, 25–6, 28, 59, bivariate normal distribution, 473 76, 97, 130, 267 Bjerksund, Stensland, 238–9, 478 CFD. See (CFD) Black, 17, 18, 163, 218, 238 change of numeraire, 203 Black-Scholes, vii, viii, 15n1, 33, 43, 48, charm, 225, 226 51, 60–8, 73–7, 121, 131–3, 145, , 289, 316–18 154–77, 182, 189, 197–200, clearing, 1–7, 11, 161, 292, 366, 368, 205–19, 228–36, 245–88, 308, 451 326, 352–5, 451, 465–9 cliquets, 319 Black-Scholes deflator, 352–6 coherent risk measures, 88–9 Black-Scholes formula, 34, 49, 173, 197, (s), 298 212–18, 237, 274, 281, 284, 294, colour, 226, 332 320, 386, 451 commodity options, 209 Black-Scholes smoothing, 49–52, 54, complete, 35, 72, 96–8, 124, 226, 464 255–6, 266, 272–3, 297 (s), 6, 10–18, 21, 30, 38, 83–4, complete market(s), 250, 265–7 155, 161, 212–14, 230, 252, 307, complex chooser option, 316 340–4, 356, 366, 452 compliance risk, 8 bonus knock-out option, 304 compound options, 324–6 Borel algebra, 103 conditional value at risk (CVaR), 85–8, Borel measurable, 103 88n3 Borel set(s), 103 conditioned contract(s), 270, 271 box algebra, 138 conditioned expectation, 106–8 Boyle, 239–40 confidence level(s), 78, 85–8 Brownian motion, 33, 43, 97, 113, consumption, 115 128–33, 155–7, 182, 189–98, , 199 249, 328, 337, 348 contingent claim(s), viii, 35–41, 70, 93, buck, 203 164, 255, 272, 275–7, 337, 344, , 402–4 351–61 butterfly spread, 324 continuous compounding, viii, 33, 73, 161, 353 contract for difference (CFD), 290–2, C 373–4 cable, 203 control variance, 77 , 323, 399, 438–41 conversion ratio, 327 capped option, 308, 340–2 correlation function, 184, 473 Index 487 correlation option(s), 327–8, 332 drift, 29, 33, 96, 125, 128, 141, 148, counterparty risk, 8, 10–11, 292 155, 212, 242, 247, 249–51, 262, co-variance, 83, 84 268 , 383, 429, 440–3 Cox-Ross-Rubenstein, 461 Crank-Nicholson, 69–70, 72, 467 E credit risk, 3, 7–12, 78 early exercise premium, 228, 236 cross, 203 equity price risk, 8 -linked options, 333–9 ES. See expected shortfall (ES) currency options, 197–235, 289 Eurodollar, 199 currency-protected option, 334 European call option(s), 37, 54, 59, 73, currency risk, 8, 197, 334, 339 92, 111, 164, 171, 173–6, 188, CUSIP, 6 196, 214, 231, 283, 299, 342, 461 CVaR. See conditional value at risk (CVaR) European digital FX option, 302 European knock-in option, 304 European knock-out option, 304 D European option(s), 29, 48, 56, 77, 115, deflators, 351–64 139, 158, 168, 180, 204, 212, delayed-start options, 318 228–31, 236, 313, 322, 368 delta, 77, 82–4, 169, 173–4, 199–208, European , 207, 314–20, 219–25, 284, 294, 308–10, 379, 334, 365, 453 400, 440, 461, 467, 470 European put option, 187 delta decay, 225 exchange option(s), 197, 327, 332–3 delta-gamma-hedging, 285–8 exercise region, 230 delta hedge, 77, 158, 161, 200, 204, exotic options, viii, 35, 289–350 205, 219, 285, 294 expectation value(s), viii, 23, 43, 100, delta-symmetric strike, 201 105–9, 141, 142, 147–51, 153, density function, 9, 105, 121–4, 165–7, 164, 172, 190–2, 195, 314, 358 172, 193, 283 expected payoff, viii, 22, 247, 345, diffusion, 29, 96, 141, 171, 240–3, 351–4 245–88 expected shortfall (ES), 85–9 diffusion process, viii, 28, 146, 147, 242, expected tail loss (ETL), 85 245, 337 explicit finite difference method, 67–8 digital option(s), 216–18, 292–8, 308, exploding spread option, 308 344–5 exponentially weighted moving average Dirac delta function, 169 model (EWMA), 187 distribution function, 98, 99, 236, 466 exponential weighted VaR, 83 distribution measure, 98 extensible option, 336–7 yield, 174, 214, 273–9 double no touch options, 300–1 Dow Jones Industrial Average, 182, 454 F down-and-out calls, 307 F-adapted, 96, 109, 142, 247 down-and-out put option, 308 fair game, 23, 24, 37, 109, 246, 247 488 Index fair value, 38, 358, 454 GARCH, 183, 185–7 fear gauge, 454 GarmanÀKohlhagen model, 197–235 , 401–6 Gaussian distributions, 348 Fenics, 205 geometric random walk, 159 Feynman–Kac, 131, 148–50, 195, 198, GeskeÀJohnson, 239 256 Girsanov, viii, 246–73, 281, 282, 353 filtration, 95–100, 109, 112, 116, 119, Girsanov kernel, 248, 253, 257, 264, 233, 249–52, 261–7, 279 282, 353 finer, 94, 99, 109, 119, 128 Girsanov theorem, 249, 253–9, 263, first in first out (FIFO), 369 269, 281 fixed domestic strike options, 335 Girsanov transformation, 246–73 fixed option, 334 Greeks, vii, 57, 70, 173, 219, 224–8, F–measurable, 96 294, 308, 324, 379, 461–9 FokkerÀPlanck, 29, 154 Green function, 170–1 foreign exchange risk, 13 forward(s), 12–15, 27, 43, 66–77, 87, 135, 142, 153, 158–63, 184–7, H 199–202, 212, 218, 273, 289, hedge parameters, 57, 173, 219 300, 318–24, 333, 338, 348, 360, hedging portfolio, 36 367–9, 371–4, 382, 393, Herstatt risk, 12 398–401, 406–23, 430–6, 442–54 heteroscedasticity, 184 forward differences, 68, 142 Hopscotch, 70–2 forward options, 289, 318–24, 333 , 43, 199, 367, 454 forward-start options, 318, 320 I forward volatility, 322–4 implicit finite difference method, 68–9 future(s), viii, 6, 8–10, 13–16, 21–3, 34, , 17, 33, 177, 178, 182, 38, 43, 68, 69, 82, 135, 154, 183, 205–7, 320–2, 380, 451 161–3, 177, 182–6, 209, 215, independent, 26–8, 65, 97, 100, 106, 218, 230, 241, 265, 273, 278–80, 107, 128, 130, 136–9, 157, 175, 290, 316–21, 324, 333, 338, 340, 212, 231, 241, 253, 265, 266, 346, 358–62, 367–74, 380, 383, 273, 320, 337, 343, 362, 447 387, 401, 406, 410, 416–19, independent σ-algebras, 106 430–3, 438, 451–4, 459 index linked bond, 356 F-, 100 indicated, 102 FX options, 197, 201–3, 209, 301, 334 indicator function, 102–5, 124, 153, 196 inflation linked claims, 355–6 G information generated by, 96 gain process, 275, 278–81 information set, 23, 24 gamma (γ), 84, 220–1, 224, 285, 379, initial , 292, 366 461, 467 integration schemas, 70 gap options, 297–8 integration theory, 103–4 Index 489 (s), viii, xi, 7–18, 21–3, log-normal distribution, 19, 44, 45, 73, 29–43, 57–9, 73–5, 83, 92, 98, 121, 133, 167 115, 128, 157–64, 174, 189, long butterfly, 436–9, 449 195–223, 233, 247–56, 278–86, long call, 294, 309, 373, 379, 397, 325, 337–44, 352–467 415–20, 425, 459 interest rate risk, 8, 13, 251 long put, 318, 374, 379–89, 429, 459 International Swaps and Derivatives long sloping synthetic forward, 416–19 Association (ISDA), 6, 7 long , 378, 379, 443–6, 459 intrinsic value, 56, 117, 215, 216, 296, long , 300, 444–9, 459 334, 376, 377 long synthetic forward, 415 ISIN code, 5, 6 Long-term capital management Itô formula, 140, 147–51, 195, 210, 247 (LTCM), 18 Itô integral, 126, 135 lookback options, 110, 289, 311 Itô lemma, 125–33, 150, 156, 165

M J marked to the market, 4 Jarrow-Rudd, 46, 47 market indexes, 451–9 Jensen’s unlikeness, 108 market price of risk, 40, 41, 249–52, Jones, Dow, 182, 291, 454 267, 352, 452 , 240–3, 266 market price of volatility risk, 267, 353 market risk, 7, 8, 12–19, 78 marking-to-model,14 K Markov, 27, 97, 110–13, 241, 242 kappa, 222 Markov process, 110–13 Knock-out and knock-in options, 289, martingale, vii, viii, 23–8, 31, 37, 62, 93, 298–311 97, 109, 115, 120, 135, 171, 188, Kolmogorov, 131, 153 233–5, 245–8, 252–9, 266, kurtosis, 83, 122 269–79, 281, 337, 345, 363 martingale approach, 171–3 martingale measure, 24, 31, 37, 93, L 233–5, 248, 254, 256–9, 266, lambda, 224 269–78, 281, 338, 345, 363 least square, 177, 180–2 martingale representation, viii, 245, 255, Lebesgue integrals, 103 279 legal risk, 8 maximum likelihood, 261–5 Leisen–Reimer model, 48–54, 461–5 maximum likelihood estimator, 187, 264 likelihood process, 252–9, 262–4 measurable, 9, 34, 95–103, 107–9, Lipschitz, 100 119–20, 143, 255, 261, 271 liquidity risk, 7 measurable space, 95, 107, 261 log-normal, 19, 44, 73, 121–5, 132, model risk, 8, 13–20 167, 198, 212, 247, 266, 315, mollification, 49 323, 344 Monte Carlo, 11, 77, 138 490 Index

Monte-Carlo simulations, vii, 72–82, partition(s), 95–100 138, 308, 315, 328, 344, 355–8 path-dependent options, 202, 298 moving strike options, 319, 321 pay-later option, 335–6 multi-asset options, 326–8, 335, 339 PDE. See partial differential equation (PDE) Peizer–Pratt, 48, 465 perpetual American put, 231–3 N pip(s), 204, 292, 299 Nasdaq, 182, 213, 291, 365–8, 454 P-martingale, 120 natural filtration, 96, 252, 267 P–measurable, 99 negative back-spread, 391–5 Poisson distribution, 241 negative price spread, 382–7, 395–9 Poisson process, viii, 240–3 negative three-leg position, 394–6 portfolio strategy(ies), 32, 254, 270–7 negative time spread, 387–9 Portfolio VaR, 84–5 neutral time spread, 438–40, 459, 460 positive back spread, 411–14 normal distribution, 10, 19, 25, 26, positive price spread(s), 384–6, 401–7, 43–7, 73, 79–83, 121, 133, 167, 419, 427, 459 187, 199, 236, 352–7, 455–8, positive stair, 417–21 466, 473 positive three leg, 424–31 normal random variable, 172, 352 positive time spread, 406–10 no-touch currency option, 299 premium-included delta, 199 NYSE, 182, 454 pre-settlement risk, 11 probability density function, 9, 122–4, 165, 172, 193 O probability distribution(s), 26–8, 60–2, ODE, 151, 191–5, 231, 280 97, 119–21, 132, 165, 184, 193, OEX, 452–3 261 OMXS index, 367–8 probability measure, 22–5, 31, 37, 93, one-touch currency option, 299 104, 105, 118–20, 196, 247–62, operational risk, 8 269, 275, 353, 358, 473 optimal exercise boundary, 230 probability space, 93–121, 252, 274, 358 options on commodities, 209 , 400–2, 459 options on options, 289, 324–6 put-call parity, 60 outcomes, 9, 21–7, 36–8, 82, 86–8, put-call symmetry, 202, 203 92–4, 104, 107, 119, 124, 133, Put Hedge, 400 139, 140, 246, 320, 325, 334, 348 outperformance option, 327 Q quadratic integrable, 110, 271 P quantity-adjusted option, 334 parity relations, 187–8 option, 339 partial differential equation (PDE), vii, quanto, , 334–9, 344–6 29, 65–70, 145–68, 175, 198, quid, 203 211, 228, 256, 273, 283 Q-Wiener process, 249–55, 279–81 Index 491

R sharpe ratio, 250, 356–7 Radon–Nikodym, 105, 118–21, 248, butterfly, 448–51 268 short call, 371–4 , 327–32, 336 short straddle, 431–5 random walk, 27–9, 96, 158, 159, 250, short strangle, 433–7 251, 266 Siegel’s Exchange Rate Paradox, 259–61 ranking the trades, 369 σ-algebra, 94, 108 ratchet options, 321–22 σ-algebra generated, 96 ratchets, 319–22 simple, 14, 21, 27–9, 34, 36, 39, 61, 79, with call options, 412, 83, 102–5, 125, 133, 142, 146, 420–4 160–1, 171, 180, 185, 189–92, ratio-spread with put options, 389–92 214–15, 230, 235, 251, 262–6, ratio spread with underlyings, 410–11 292, 313–19, 340, 352, 358 reachable, 36, 255, 273, 277–8 skewness, 83, 122, 206, 457 rebate clause, 307 soft call provision, 307 relative portfolio, 156 Standard & Poor’s (S&P), 6, 182, 183, replicating portfolio, 36, 62, 188, 338 291, 332, 452–5, 457, 458 resetting options, 319 splitting index S(E), 95 rho, 57, 223–8, 380, 451, 461, 467 spread betting, 291 Richardson extrapolation, 48–55, 63 spread option, 308, 327 RIC-name, 368 SPX, 452, 453 Riemann integral, 126 standard deviation, 9, 10, 74, 81–3, 139, risk averse, 38, 39, 290 155, 177, 249, 349–52, 454–7, risk neutral drift of volatility, 212 473 risk-neutral probabilities, 24, 33–5, 40, standard error, 75–6 93, 119, 353 state prices, 358–64 risk neutral valuation, 31, 38–43, 98, stochastic differential equation (SDE), 351–62 100, 127, 146–51, 165, 210, 243, risk-neutral valuation formula,31 349 risk premium, 23, 41, 158, 249, 352–4 stochastic integral, 135, 142, 147 Roll, Geske, 236, 472 stochastic integration, 133–43 , 23, 27, 33, 43, 73, 96, 97, 107–9, 125, 131, 140, 146, S 155, 210, 254, 276, 348, 353 sample space, 21, 22, 91–3, 104, 119 stochastic variable, 30, 36, 43, 91, 96, 99, Scandies, 203 105–7,109,116,212,255,270 SDE. See stochastic differential equation , 16, 20, 72, 210–12, SEDOL. See Stock Exchange Daily 250, 267 Official List Stock Exchange Daily Official List self financed, 156, 254–6, 270–2, 274–7 (SEDOL), 6 self-financing, 32, 271, 280 stopping times, 113–17, 234–5 settlement, 1–7, 11, 12, 322, 367 straddle, 201, 300, 316–18, 324, 378, Settlement risk, 12 379, 431–5, 443–7 492 Index strangle, 206, 300, 324, 433–7, 444–6 Vanna, 225 structured products, 340, 344 VaR. See Value-at-Risk (VaR) sub martingale, 24, 109, 235 variance, ix, 10, 26–9, 43, 47, 73, 76–8, super martingale, 24, 109, 115 81–4, 87, 97, 101, 121–3, SWIFT, 2, 7 128–30, 133, 137–9, 155, 172, Synthetic Call, 400–2 183, 184, 186, 198, 207, 329, synthetic contracts, 372–4 352, 356 Synthetic sold put, 440–3 variance reduction, 76–7 variation margin, 4, 292 vega, 57, 222–4, 227, 295, 309, 322–4, T 380, 461, 467 tau, 223 VIX futures, 452, 454 Taylor series expansion, 243 VIX volatility index, 182 theta, 221–6, 295, 309, 379, 461, 467 VKN number, 5 Tian, 47 volatility, viii, 8, 33, 125, 148, 247, 300, Tigori, 47 353, 376 time value, 50, 215, 220, 229–31, 296, volatility heat map, 454, 456 376–9, 383, 386, 399, 403, 442 volatility surface, 177–82, 206 touch options, 308 volga, 224 Tower property, 101 VVIX, 454, 455 transition probabilities, 152–3 , 67, 239–40 20/20 Option, 332 W 2X,99 , viii, 346–50 Whaley, R. E., 236, 472 Wiener process, 33, 96–100, 113, 129, U 136, 140, 147, 155, 190, 210, Uhlenback process, 348–50 245, 249, 253–8, 262–81, 348 up-and-out puts, 307–8 window barrier knock-in option, 305 window barrier knock-out option, 305 WKN, 6 V WPKN, 6 Value-at-Risk (VaR), 13, 18–20, 27, 78–89 value process, value processes, 30, 32, 35, Y 62, 92, 113, 115, 155, 156, 255, yard, 203 270, 272, 280