Finite Difference Approach to Option Pricing February 998 CS5 Lab Note. Ordinary differential equation An ordinary differential equation, or ODE, is an equation of the form du = fut ( (), t) (.) dt where t is the time variable, u is a real or complex scalar or vector function of t, and f is a function. Initial value problem is to find a differentiable function ut () such that u( ) = u (.) du () t = fut ( (), t) for all t [, T] dt For the solution of ordinary differential equations, one of the most powerful discretization strategies is linear multistep methods. Let k > be a real number, the time step, and let t, t, t,... be defined t n = nk. Our goal is to construct a sequence of values v, v,... such that Let f n be the abbreviation v n ut ( n ) n (.3) = fv ( n, t n ). (.4) A linear multistep method is a formula for calculating each new value v n + from some of the previous values v,..., v n and f,..., f n. The simplest linear multistep method is a one step method : the Euler formula defined by f n + = v n + kf n v n Euler method is an example of an explicit one-step formula. (.5) A related linear multistep formula is the backward Euler, also a one-step formula, defined by + = v n + kf n + v n (.6) v n + To implement an implicit formula, one must employ a scheme to solve for the unknown, and this involves extra work.
The advantage of an implicit method is that in some situations it may be stable when an explicit one is catastrophically unstable. Throughout the numerical solution of differential equations, there is a tradeoff between explicit methods, which tend to be easier to implement, and implicit ones, which tend ot be more stable. Example - du dt = uu, ( ) = + = v n + kv n, v = (Euler method) v n + = v n + kv n +, v = (Backward Euler method) v n (.7) (.8) Example - More formulas Trapezoid rule(implicit one-step formula) + = v n + k -- ( f n + f n + ) v n (.9) Midpoint rule(explicit two-step formula) v n + = v n + kf n (.). Partial Differential Equation Partial differential equations fall roughly into three great classes which can be loosely described as follows elliptic -- time-dependent parabolic -- time-dependent and diffusive hyperbolic -- time-dependent and wave like The simplest example of a hyperbolic equation is u t the one-dimensional first-order wave equation, which describes advection of a quantity at the constant velocity. = u x (.) ux (, t)
The simplest example of a parabolic equation is u t = (.) the one-dimensional heat equation, which describes diffusion of a quantity such as heat or salinity. Let h > and kbe > a fixed space step and time step, respectively and set x j = and jh t n = nk for any integers j and n. The points ( x j, t n ) define a regular grid or mesh in two dimensions. n The aim of finite difference is to approximate continuous functions ux (, t) by grid functions v j, u x ux ( j, t n ) v n n represents the spatial grid function { for v j, a j fixed Z} value. n v j n (.3) The simplest kind of finite procedure is an s-step finite difference formula, which is a fixed n + formula that prescribes v j as a function of a finite number of other grid values at time steps n + s through n(explicit case) or n+ (implicit case). To compute an approximation n { v j } to ux (, t), we shall begin with initial data v,..., v s, and compute values v s, v s +,... in succession by applying finite difference formula. This process is sometimes known as marching with respect to t. Example u u k Finite difference approximations for the heat equation =, with σ = ----. t x h n + n n n n Euler : v j = v j + σ( v j + v j + v j ) n + n n + n + n + Backward Euler : v j = v j + σ( v j + v j + v j ) n + n n n n n + n + n + Crank-Nicholson : v j = v j + -- σ ( v j + v j + v j ) + -- σ ( v j + v j + v j ) (The above two sections are from unpublished manuscript of Lloyd N. Trefethen)
3. Option Pricing via Finite Difference Method 3. Implicit method(see lecture note for derivation and notation) Let f i, j denote the value of option price at the ( i, j) point, i.e., when tand = i t S. = j S Implicit method for American put option is a j f i, j b j f i, j c j f i, j + = f i +, for i j =...N,,, and j =...M,,, where a j = -- rj t -- σ j t b j = + σ j t+ r t c j = -- rj t -- σ j t (3.) (3.) MATLAB Implementation function put = imfdamput(smax, ds, T, dt, X, R, SIG); % put = imfdamput(smax, ds, T, dt, X, R, SIG); % Smax : maximum stock price % ds : increment of stock price % T : maturity date % dt : time step % X : exercise price % R : risk free interest rate % % reference : John C. Hull, Options, Futures, and Other Derivatives % 3rd Ed., Chap 5 M = ceil(smax/ds); ds = Smax / M; N = ceil(t/dt); dt = T / N; J = :M-; a =.5*R*dt*J -.5*SIG^*dt*J.^; b = + SIG^*dt*J.^ + R*dt; c = -.5*R*dt*J -.5*SIG^*dt*J.^; A = diag(b) + diag(a(:m-), -) + diag(c(:m-), ); put = zeros(n+, M+); put(n+, :) = max(x - [:ds:smax], ); put(:, ) = X; put(:, M+) = ; for i = N:-:
end y = put(i+, :M) ; y() = y() - a()*x; put(i, :M) = [A \ y] ; put(i, :) = max(x - [:ds:smax], put(i,:)); The following figure shows the American put option price when Smax = 5; ds = ; T = ; dt =.; X = 5; R =.; and SIG =.5;. 5 4 3.8.6.4. 5 5 Time Stock Price 3. Explicit Method The difference equation is where f i j, = a j f i +, j + b j f i +, j + c j f i +, j + a j = ----------------- -- rj t + -- σ j t + r t b j = ----------------- ( σ j + r t t ) c j ----------------- = + r t -- rj t + -- σ j t (3.3) (3.4) For the explicit method to be stable, all be positive. --rj t + -- σ j t, σ j t, -- rj t + -- σ j t should
MATLAB Implementation function put = exfdamput(smax, ds, T, dt, X, R, SIG); M = ceil(smax/ds); ds = Smax / M; N = ceil(t/dt); dt = T / N; J = :M-; a = (-.5*R*dt*J +.5*SIG^*dt*J.^) / (+R*dt); b = ( - SIG^*dt*J.^) / (+R*dt); c = (.5*R*dt*J +.5*SIG^*dt*J.^) / ( + R*dt); A = diag(b) + diag(a(:m-), -) + diag(c(:m-), ); put = zeros(n+, M+); put(n+, :) = max(x - [:ds:smax], ); put(:, ) = X; put(:, M+) = ; for i = N:-: end y = zeros(, M-); y() = a()*put(i+, ); y(m-) = c(m-)*put(i+,m+); put(i, :M) = put(i+, :M) * A + y; put(i, :) = max(x - [:ds:smax], put(i,:)); The following figure shows the unstability of the explict method with the wrong choice of Smax = ; ds = 5; T = ; dt =.; R =.; SIG =.4; and X = 5. American Put : Explicit FD 35 3 5 5 5 5.8.6 Time.4. 4 Stock Price 6 8 It s stable when Smax = 5; ds = 5; T = ; dt =.; X = 5; R =.; and SIG =.5.
American Put : Explicit FD 5 5 5.8.6 Time.4. Stock Price 3 4 5 3.3 Crank-Nicholson Method The Crank-Nicholson scheme is an average of the explicit and implicit methods. It s given by and g i, j = f i j, a j f i, j b j f i, j c j f i, j + (3.5) g i j, = a j f i, j + b j f i, j + c j f i, j + f i, j The implementation of the Crank-Nicholson method is similar to that of the implicit method. (3.6) MATLAB Implementation function put = cnfdamput(smax, ds, T, dt, X, R, SIG); M = ceil(smax/ds); ds = Smax / M; N = ceil(t/dt); dt = T / N; J = :M-; a = (-.5*R*dt*J +.5*SIG^*dt*J.^) / (+R*dt); b = ( - SIG^*dt*J.^) / (+R*dt); c = (.5*R*dt*J +.5*SIG^*dt*J.^) / ( + R*dt); A = diag(-b) + diag(-a(:m-), -) + diag(-c(:m-), ); aa =.5*R*dt*J -.5*SIG^*dt*J.^; bb = + SIG^*dt*J.^ + R*dt; cc = -.5*R*dt*J -.5*SIG^*dt*J.^; B = diag(bb-) + diag(aa(:m-), -) + diag(cc(:m-), );
g = zeros(, M-); put = zeros(n+, M+); put(n+, :) = max(x - [:ds:smax], ); put(:, ) = X; put(:, M+) = ; for i = N:-: end g = put(i+, :M) * A ; g() = g() - a()*x - aa()*x; put(i, :M) = [B \ g ] ; put(i, :) = max(x - [:ds:smax], put(i,:)); Using finite difference methods, we can get the boundary between the regions where it s optimal to exercise an American option or not. The following figure shows different boundaries for SIG =.:.:.9. The first curve from the right is when SIG =.. Free boundary : American Put Option.9.8.7.6 Time.5.4.3.. 3 4 5 6 7 8 9 Stock Price