Download Excel implementation of finite difference methods for option pricing

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Black–Scholes model wikipedia , lookup

Transcript
Spreadsheets in Education (eJSiE)
Volume 9 | Issue 3
Article 2
12-8-2016
Excel implementation of finite difference methods
for option pricing
Timothy J. Kyng
Macquarie University, [email protected]
Sachi Purcal
Macquarie University, [email protected]
Jinhui C. Zhang
Macquarie University, [email protected]
Follow this and additional works at: http://epublications.bond.edu.au/ejsie
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works
4.0 License.
Recommended Citation
Kyng, Timothy J.; Purcal, Sachi; and Zhang, Jinhui C. (2016) Excel implementation of finite difference methods for option pricing,
Spreadsheets in Education (eJSiE): Vol. 9: Iss. 3, Article 2.
Available at: http://epublications.bond.edu.au/ejsie/vol9/iss3/2
This Regular Article is brought to you by the Bond Business School at ePublications@bond. It has been accepted for inclusion in Spreadsheets in
Education (eJSiE) by an authorized administrator of ePublications@bond. For more information, please contact Bond University's Repository
Coordinator.
Excel implementation of finite difference methods for option pricing
Abstract
This paper presents and explains finite difference methods for pricing options and shows how these methods
may be implemented in Excel. We cover both the explicit and the implicit finite difference methods. Each uses
a numerical approximation to the partial differential equation and boundary condition to convert the
differential equation to a difference equation. The difference equation can be solved using Excel and this
solution is a numerical approximation to the option price. This paper explains how we obtain the difference
equation from the differential equation and shows the reader how to implement and solve the difference
equation using Excel.
Keywords
Option pricing, Numerical methods, Finite difference method, Implicit scheme, Explicit scheme, Excel
implementation.
Distribution License
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 4.0
License.
Cover Page Footnote
Corresponding author: [email protected] Department of Applied Finance and Actuarial Studies,
Faculty of Business and Finance, Macquarie University, Sydney, NSW, 2109, Australia.
This regular article is available in Spreadsheets in Education (eJSiE): http://epublications.bond.edu.au/ejsie/vol9/iss3/2
Kyng et al.: Finite difference methods for option pricing in excel
1
Introduction
Options are significant in the financial markets due to their use in financial product
design, risk management applications, speculation, remuneration, and valuation of
other securities. They are very actively traded by banks and other entities. There are
many different types of option contract ranging from very simple to very complex.
Based on the foundations built in Black and Scholes (1973), the literature has
proposed and implemented numerous models and methods for option pricing. There
are many option contracts for which a closed form valuation formula is not available.
In such circumstances we need to use numerical methods to solve the option pricing
problem.
Cox, Ross and Rubinstein (1979) proposed a binomial tree method for option
pricing. Generally the implementation of this binomial method tree is relatively
easy to teach and for students to understand. It is readily implemented in Excel.
Small scale examples can illustrate the major ideas of hedging, replication, risk
neutral discounted expectation pricing and backwards recursion.
Following Cox, Ross and Rubinstein (1979), Boyle (1986) extended the binomial
tree method to a trinomial tree method in which the stock price of each time period is
assumed to have three outcomes: up, down and stable. With an additional outcome
(stable) the trinomial tree method has higher accuracy than the binomial one.
Another widely used numerical method is the finite difference method. Indeed,
the explicit finite difference method can be considered as a generalised version of
the trinomial tree method. The implicit and explicit finite difference methods deal
with the problem of computing the option price by approximating the partial differential equation by a difference equation and then numerically solving the difference
equation. The binomial methods can be thought of as solving the problem using a
discounted expectations approach via backwards recursion instead.
In our experience teaching actuarial and finance students about the binomial option pricing model is relatively easy, but teaching them about the finite difference
method for option pricing is quite difficult. These students typically have no previous exposure to partial differential equations or software other than spreadsheets.
Our purpose in writing this paper is to facilitate the teaching and learning of this
part of option pricing theory. We believe that exposition of the topic via Excel is
an excellent way to present the method and makes it much easier for students to
Published by ePublications@bond, 2016
1
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
understand.
In this paper, we explain how to implement finite difference methods for option
pricing using Excel. We explain the connection between the Black Scholes partial
differential equation (PDE) and the finite difference methods for option pricing. The
implicit and explicit finite difference approximations are examined in section 2 and
in section 3 we discuss their implementation in Excel for European and American
call and put options. Section 4 concludes.
2
Finite Difference Methods for Numerical Computation of Option Price
From Black and Scholes (1973), the Black-Scholes partial differential equation is
∂F
1
∂ 2F
∂F
+ (r − y) S
+ σ 2 S 2 2 − rF = 0
∂t
∂S
2
∂S
(1)
with boundary conditions for the European call option of
F (S, T ) = max(S − K, 0),
F (0, t) = 0,
(2)
(3)
and, for S → ∞,
F (S, t) = Se−y(T −t) − Ke−r(T −t) ,
(4)
where the domain on which the function F is defined is D = {(S, t) : S ≥ 0, 0 ≤ t ≤ T },
and F is the option price, t represents time, S is the stock price, K is the exercise
price, y is the dividend yield, r is the risk free rate, σ is the volatility of the stock
and T is the maturity date. The details of the proof can be found in Wilmott (2013)
and Andreasen, Jensen and Poulsen (1998).
Solving the PDE analytically means finding F (S, t) which satisfies both the PDE
(1) and boundary conditions (2)–(4) on the domain D. Changing the boundary
conditions will change the solution. Here we discuss the European call option. As
we shall show below, for the call option boundary conditions the solution to the
PDE is
F (S, t) = Se−yτ N (d1 ) − Ke−rτ N (d2 ),
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
(5)
2
Kyng et al.: Finite difference methods for option pricing in excel
where
ln S/K + (r − y + σ 2 /2) τ
√
,
σ τ
ln S/K + (r − y − σ 2 /2) τ
√
d2 =
σ τ
d1 =
(6)
(7)
and τ = T −t is the time remaining till maturity as at time t; N (d) is the cumulative
normal density function.
If we change the boundary conditions to those for a European put option, which
are
F (S, T ) = max(K − S, 0),
−r(T −t)
F (0, t) = Ke
− Se
−y(T −t)
(8)
(9)
and, for S → ∞
F (S, t) = 0,
(10)
then the solution to the PDE is
F (S, t) = Ke−rτ N (−d2 ) − Se−yτ N (−d1 ).
(11)
For many options (such as American options), there are no known analytic closed
form solutions. In such cases we need to solve the PDE numerically. We address
this problem in section 2.1 and the following.
To solve the PDE subject to its boundary conditions, we first convert it to another
PDE we know how to solve by doing a set of transformations. This transformed
PDE is in fact the heat equation from physics. It will have a boundary condition,
too. We then solve this PDE using well known methods, namely a Green’s function.
We then reverse the transformations we did to get to the heat equation from the
Black-Scholes equation, and this gives us our final solution, (5)–(7). The details of
derivations can be found in Wilmott, Howison and Dewynne (1995).
Similarly, we can develop a closed form result for F as a put option price which
is subject to boundary conditions (8)–(10).
As shown above, obtaining a closed form result is not straightforward. We have
also noted above that for many options it is not possible to obtain a closed form
Published by ePublications@bond, 2016
3
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
result. Thus, one must turn to numerical methods for a complete solution to the
option pricing problem.
The class of numerical methods we focus on are known as finite difference methods.
They use a finite difference approximation to the partial derivatives in the PDE.
This converts the partial differential equation into a difference equation which we
can solve numerically. It does this by using a discrete model of stock price, time
and option value.
Before we pass on to a detailed discussion of this approach we must first set the
scene for the numerical approach by adjusting the boundary conditions. For the call
option, we adapt the definition of boundary condition (4) to apply for S ≥ Smax ,
whereas previously it applied for the more general S → ∞. Similarly, for the put
option, boundary condition (9) applies now for S ≤ Smin while boundary condition
(10) applies for S ≥ Smax .
Here, the term Smax means some value of S above which the call option is sufficiently deep in the money that its value converges to that of a long forward contract.
Conversely, the term Smin means some value of S below which the put option is
sufficiently deep in the money that its value converges to that of a short forward
contract. As the stochastic process underlying the stock price is geometric Brownian
motion, the probability distribution of the stock price at any time prior to maturity
is lognormal. The extreme values (Smax and Smin ) of S need only be a few standard
deviations above or below its mean for options to be deeply in or out of the money.
2.1
Finite Difference Approximations
Below we use the finite difference method to price an European put option . Hence
we need to define the increments ∆S and ∆T in order to obtain the finite difference
approximated form of the required partial derivatives.
Assume N equally spaced time intervals over the term of the option, T . Then
∆T , which is the length of each interval, is ∆T = T /N . A European put option
is deeply out of the money when the stock price S is extremely high. We assume
there exists a stock price Smax such that, for S ≥ Smax , the put option is deeply out
of the money with a value that is approximately zero, that is
S ≥ Smax ⇒ F (S, t) = 0.
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
(12)
4
Kyng et al.: Finite difference methods for option pricing in excel
Conversely, a European put option is deeply in the money when the stock price
S is extremely low. We can assume there exists a low stock price S ≤ Smin which
makes the option deeply in the money and certain to be exercised at expiration.
Hence, the option can be approximately regarded as a forward contract
S ≤ Smin ⇒ F (S, t) = Ke−r(T −t) − Se−y(T −t) .
Usually, we choose Smin = 0, so that
S = Smin ⇒ F (S, t) = Ke−r(T −t) .
(13)
Breaking up the stock price into M equally spaced stock prices between Smin and
Smax , we obtain a stock price increment of ∆S = (Smax − Smin )/M . This allows us
to create a grid like figure 1 of stock prices and times defined by an index i, which
indexes the time, and an index j, which indexes the stock price level. We need
to carefully choose the spacing in the stock price to ensure that one of the nodes
coresponds to the current stock price. The range of values of i is i = 0, 1, 2, . . . , N ,
and there are N +1 different values of i. The range of values of j is j = 0, 1, 2, . . . , M .
The entry in row j and column i of the table is the stock price at time i × ∆T
after an increase of amount j × ∆S in the stock price from the level Smin . That is,
the stock price is S(i,j) = Smin + j × ∆S at row j and column i of the table. If we
have Smin = 0 then S(i,j) = j × ∆S; we assume this hereafter.
We define the function f (i, j) = F (j × ∆S, i × ∆T ) as a discretised version of the
function F . There are (M + 1) × (N + 1) different values of the function f (i, j).
The differential equation for the function F (S, T ) becomes a difference equation for
f (i, j) through the use of finite difference approximations to the partial derivatives
in the PDE. We show the detailed derivation of the difference equation later.
In this paper, we demonstrate the finite difference method with a numerical example in Excel. All parameter values are shown in table 1. Suppose we have an
European put option with certain parameters: initial stock price S = $30, exercise
price K = $30 and term to maturity T = 0.75. For the grid, the number of time
increments (steps) is N = 3 and the number of stock increments is M = 6. We also
set the maximum stock price at Smax = 60 and minimum stock price at Smin = 0.
Therefore the time increment is ∆T = T /N = 0.25 and stock price increment is
∆S = (Smax − Smin )/M = 10. We also set the risk-free rate r = 10%, the dividend
yield rate to y = 0% and volatility σ = 40%. We demonstrate our grid of stock
prices in table 2.
Published by ePublications@bond, 2016
5
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
𝟎
0
𝐒𝐦𝐢𝐧
𝚫𝑻
1
𝟐𝚫𝑻
𝟑𝚫𝑻
𝟒𝚫𝑻
𝟓𝚫𝑻
2
3
4
5
𝟔𝚫𝑻
6
(N)
𝒕
i
0
𝐒𝐦𝐢𝐧 + 𝚫𝑺
1
𝐒𝐦𝐢𝐧 + 𝟐𝚫𝑺
2
𝐒𝐦𝐢𝐧 + 𝟑𝚫𝑺
3
𝐒𝐦𝐢𝐧 + 𝟒𝚫𝑺
4
𝐒𝐦𝐢𝐧 + 𝟓𝚫𝑺
5
𝚫𝑺
𝐒𝐦𝐚𝐱
6
(M)
𝑺
j
𝚫𝑻
Figure 1: The structure of the grid used in the finite difference approximation. The horizontal axis represents time T , increasing from left to right in steps
of ∆T . Each time step is indexed by i, which runs from 0 to its largest value of N .
The vertical axis captures the stock price S, increasing from top to bottom in steps
of ∆S from Smin to Smax . Each price level is indexed by j, which runs from 0 to
its largest value of M . In this example both M and N are six, and if we were to
summarise the graph in a table it would have seven rows (M + 1) and seven columns
(N + 1).
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
6
Kyng et al.: Finite difference methods for option pricing in excel
Table 1: Parameter values for the numerical example
Symbol
S
K
T
N
Smax
Smin
M
∆T
∆S
r
y
σ
Meaning
Initial stock price (dollars)
Exercise value (dollars)
Term to maturity (years)
Number of time increments (steps)
Maximum stock price (dollars)
Minimum stock price (dollars)
Number of stock price increments
Time increment (years)
Stock price increment (dollars)
Risk free rate (continuously compounding
annual rate)
Dividend yield (continuously compounding
annual rate)
Volatility (the standard deviation of the
yearly logarithmic returns)
Value
30
30
0.75
3
60
0
6
0.25
10
0.1
0
0.4
Table 2: Stock prices S(i,j) at all nodes on the grid corresponding to the
parameters in table 1. Here S(i,j) = j × ∆S at time i × ∆T .
j
j
j
j
j
j
j
Published by ePublications@bond, 2016
=0
=1
=2
=3
=4
=5
=6
i=0
0.00
10.00
20.00
30.00
40.00
50.00
60.00
i=1
0.00
10.00
20.00
30.00
40.00
50.00
60.00
i=2
0.00
10.00
20.00
30.00
40.00
50.00
60.00
i=3
0.00
10.00
20.00
30.00
40.00
50.00
60.00
7
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
We now continue our numerical example by starting to build a table of f (i, j). At
a start, with boundary conditions: (8), (12) and (13), we can fill the numbers along
the right hand edge, the top edge and the bottom edge of the table. This gives us
table 3.
Table 3: Values of f (i, j) along the boundary of the grid. Values at the right
hand edge are given by the boundary condition at maturity, equation (8). At the
bottom edge, use (10), modified by our discussion above to become (12). The top
edge is given by (9), modified by our discussion above to become (13).
j
j
j
j
j
j
j
2.2
=0
=1
=2
=3
=4
=5
=6
i=0
27.83
i=1
28.54
i=2
29.26
0
0
0
i=3
30
20
10
0
0
0
0
Implicit Finite Difference Method
There are three common types of finite difference approximation to the derivative.
A finite difference approximation to the derivative of F with respect to S at time
i × ∆T and with stock price j × ∆S is ∂F /∂S ≈ (f (i, j + 1) − f (i, j))/∆S. This
is called a forward difference approximation. Another approximation is ∂F /∂S ≈
(f (i, j) − f (i, j − 1))/∆S, which is known as a backward difference approximation.
A third approximation is the average of the previous two,
∂F /∂S ≈ (f (i, j + 1) − f (i, j − 1))/2∆S. Choosing to work with a particular approximation leads to a particular finite difference method, as we shall see below.
The derivative of F with respect to t at time i × ∆T can be finite difference
approximated as ∂F /∂t ≈ (f (i + 1, j) − f (i, j))/∆T , which is a forward difference
approximation.
For the second derivative of F with respect to S at time i × ∆T and with stock
price j × ∆S, the finite difference approximation can be written as ∂ 2 F /∂S 2 ≈
(f (i, j + 1) + f (i, j − 1) − 2f (i, j))/(∆S)2 . We can derive this as follows. Since
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
8
Kyng et al.: Finite difference methods for option pricing in excel
the backwards difference approximation to ∂F /∂S at time i × ∆T , with stock price
j × ∆S and (j + 1) × ∆S, are ∂F /∂S ≈ (f (i, j) − f (i, j − 1))/∆S and ∂F /∂S ≈
(f (i, j + 1) − f (i, j))/∆S, the difference of these two approximations divided by
∆S is an approximation to ∂ 2 F/∂S 2 . That is,
∂ 2F
1
f (i, j + 1) − f (i, j) f (i, j) − f (i, j − 1)
−
×
(14)
≈
2
∂S
∆S
∆S
∆S
which, after some manipulation, yields the result stated at the beginning of the
paragraph.
Now we make the following substitutions into the Black-Scholes PDE (1) and
this will allow us to derive formulae for what is known as the implicit finite difference method. Taking the approximation to ∂ 2 F/∂S 2 given in the paragraph above,
the ‘average’ approximation to ∂F/∂S, the forward approximation to ∂F/∂t, and
recalling f (i, j) is our discretised version of F , and substituting into (1) we obtain
0 =
f (i + 1, j) − f (i, j)
∆T
f (i, j + 1) − f (i, j − 1)
+ (r − y) × (j∆S)
2 × ∆S
1 2
f (i, j + 1) + f (i, j − 1) − 2f (i, j)
2
+ σ (j∆S)
2
(∆S)2
−rf (i, j) .
Then, the above equation can be rewritten as,
f (i, j − 1) · a (j) + f (i, j) · b (j) + f (i, j + 1) · c (j) = f (i + 1, j) ,
(15)
where the coefficients a, b and c are defined by
1
1
(r − y) × j∆T − ∆T σ 2 j 2 ,
2
2
2 2
b (j) ≡ 1 + σ j ∆T + r∆T
a (j) ≡
(16)
(17)
and
1
1
c (j) ≡ − (r − y) × j∆T − ∆T σ 2 j 2
2
2
(18)
for i = 0, 1, 2, ..., N − 1 and j = 0, 1, 2, ..., M − 1.
Published by ePublications@bond, 2016
9
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
𝐒𝐦𝐢𝐧
𝟎
𝚫𝑻
𝟐𝚫𝑻
𝟑𝚫𝑻
𝟒𝚫𝑻
𝟓𝚫𝑻
0
1
2
3
4
5
𝟔𝚫𝑻
6
0
𝐒𝐦𝐢𝐧 + 𝚫𝑺
1
𝐒𝐦𝐢𝐧 + 𝟐𝚫𝑺
2
𝐒𝐦𝐢𝐧 + 𝟑𝚫𝑺
3
𝐒𝐦𝐢𝐧 + 𝟒𝚫𝑺
4
𝐒𝐦𝐢𝐧 + 𝟓𝚫𝑺
5
(N)
𝒕
i
𝚫𝑺
𝐒𝐦𝐚𝐱
6
(M)
𝑺
j
𝚫𝑻
Figure 2: Implicit finite difference method on the grid. This is a graphical
representation of equation (15). One sees the link between the option value at
stock price S = j∆S and time t = (i + 1)∆T with the nodes at time t = i∆T
and neighbouring stock prices. Our solution method proceeds backwards in time.
As it does so, nodes at time i∆T are determined by all the option values at time
(i + 1)∆T . Thus, values are not determined by their preceding neighbouring values,
but in concert with all nodes at time (i+1)∆T , and so we term the method ‘implicit’.
Equation (15) is represented diagrammatically in figure 2. There we see the link
between a node at time t = (i + 1)∆T and stock price S = j∆S with nodes at
time t = i∆T and stock prices (j − 1)∆S, j∆S and (j + 1)∆S. As our solution
process proceeds backwards through time (moving from right to left in figure 2),
this approach is known as an implicit method—any node at time i∆T is not directly
determined by particular nodes at time (i + 1)∆T , but rather in concert with all
nodes at time (i + 1)∆T . That is, at each time point, we have a set of simultaneous
equations to solve, as we shall see below. This point will become clear as we detail
the solution procedure below.
To price the option at t = 0, we first need to start with the values f (i, j) for
i = N which are known, as these are the payoffs at maturity. At i = N − 1 (one
time step before maturity) the boundary conditions (discussed in table 3) give us
values at j = 0 and M . For the intermediate values j = 1, 2, ..., M − 1, the values
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
10
Kyng et al.: Finite difference methods for option pricing in excel
f (N − 1, j) are still unknown. To compute those values, we make use of the M − 1
equations (15).
The numerical values of the coefficients a, b and c must first be calculated as
functions of j, for which we take the values of the parameters r, y and σ from table
1. This yields the values of the coefficients a, b and c for the different values of j
that appear in table 4. Note they vary by the stock price step on our solution grid;
they do not vary by the time step.
Table 4: Coefficients of equation (15) for our implicit finite difference example. The coefficients are calculated using equations (16)–(18) and the parameters
in table 1.
Stock price node
j
0
1
2
3
4
5
6
Implicit example coefficients
a(j)
b(j)
c(j)
0.000 0
1.025 0
0.000 0
-0.007 5
1.065 0
-0.032 5
-0.055 0
1.185 0
-0.105 0
-0.142 5
1.385 0
-0.217 5
-0.270 0
1.665 0
-0.370 0
-0.437 5
2.025 0
-0.562 5
-0.645 0
2.465 0
-0.795 0
For this example, when j = 2 and substituting into equations (16)–(18), we have
a (j) =
=
b (j) =
c (j) =
=
1
1
(0.10 − 0.00) × 2 × 0.25 − × 0.25 × 0.402 × 22
2
2
0.025 − 0.08 = −0.055
1 + 0.42 × 22 × 0.25 + 0.10 × 0.25 = 1 + 0.16 + 0.025 = 1.185
1
1
− (0.10 − 0.00) × 2 × 0.25 − × 0.25 × 0.402 × 22
2
2
−0.025 − 0.08 = −0.105
The calculations are tedious to do by hand, but very easy to do in a spreadsheet.
Our solution method proceeds recursively, moving backwards in time, from the
highest time node values to the lowest. We set i in equation (15) to N − 1, which
for our grid with N = 3 and M = 6, is 2.
Published by ePublications@bond, 2016
11
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
For this fixed i = 2, we must consider the possible values of j (excluding the
boundaries), which range from 1 to 5. Thus, we have
f (2, 0) · a (1) + f (2, 1) · b (1) + f (2, 2) · c (1) = f (3, 1) ,
(19)
f (2, 1) · a (2) + f (2, 2) · b (2) + f (2, 3) · c (2) = f (3, 2) ,
f (2, 2) · a (3) + f (2, 3) · b (3) + f (2, 4) · c (3) = f (3, 3) ,
f (2, 3) · a (4) + f (2, 4) · b (4) + f (2, 5) · c (4) = f (3, 4)
(20)
(21)
(22)
f (2, 4) · a (5) + f (2, 5) · b (5) + f (2, 6) · c (5) = f (3, 5) .
(23)
and
We can rewrite the first equation (19) as
f (2, 1) · b (1) + f (2, 2) · c (1) = f (3, 1) − f (2, 0) · a (1) ,
(24)
where the function values f on the RHS of (24) are known (boundary values we
calculated previously) while those on its LHS are unknown. Equation (20) to (22)
already fit this pattern; all that remains is to adjust the last equation (23) to
f (2, 4) × a (5) + f (2, 5) × b (5) = f (3, 5) − f (2, 6) × c (5) .
(25)
The above set of five equations (24), (20), (21), (22) and (25), i.e., the first and
last modified equations and the original middle three from above can be written in
matrix form as
 
 

 
b (1) c (1)
0
0
0
f (2, 1)
f (3, 1)
f (2, 0) a (1)
 a (2) b (2) c (2)
  f (2, 2)   f (3, 2)  
0
0
0

 
 
 
 0






a (3) b (3) c (3)
0  ×  f (2, 3)  =  f (3, 3)  − 
0

 0






0
a (4) b (4) c (4)
f (2, 4)
f (3, 4)
0
0
0
0
a (5) b (5)
f (2, 5)
f (3, 5)
f (2, 6) c (5)



,


which is a set of five simultaneous equation in five unknowns—the f (2, ·) values
are unknown, whereas the f (3, ·), f (2, 0) and f (2, 6) values are known from our
boundary conditions.
Rearranging, we can easily solve for these unknown values in Excel
 
−1 
f (2, 1)
b (1) c (1)
0
0
0
f (3, 1) − f (2, 0) a (1)
 f (2, 2)   a (2) b (2) c (2)


0
0
f (3, 2)

 


 f (2, 3)  =  0


a (3) b (3) c (3)
0  ×
f (3, 3)

 
 f (2, 4)   0

0
a (4) b (4) c (4) 
f (3, 4)
f (2, 5)
0
0
0
a (5) b (5)
f (3, 5) − f (2, 6) c (5)

http://epublications.bond.edu.au/ejsie/vol9/iss3/2



 . (26)


12
Kyng et al.: Finite difference methods for option pricing in excel
Equation (26) provides us with the values of the function f at time step i = 2 in
terms of f values at time step i = 3. Indeed, in general, we can obtain the values of
f (i − 1, ·) from the values of f (i, ·). Therefore, the option values at the start of the
grid, i.e., f (0, ·), can be eventually calculated from the known maturity values, i.e.,
f (T, ·). This step-by-step calculation process is known as backward recursion, or a
time-marching approach.
For our particular numerical example in (26), the matrix1


b (1) c (1)
0
0
0
 a (2) b (2) c (2)
0
0 


 0
a (3) b (3) c (3)
0 


 0
0
a (4) b (4) c (4) 
0
0
0
a (5) b (5)
1.065 −0.0325
0
0
0
 −0.055 1.185 −0.105
0
0

0
−0.1425
1.385
−0.2175
0
=


0
0
−0.270 1.665 −0.37
0
0
0
−0.4375 2.025
is known, as is the vector

f (3, 1) − f (2, 0) × a (1)

f (3, 2)


f (3, 3)


f (3, 4)
f (3, 5) − f (2, 6) × c (5)


 
 
=
 
 
20 − 29.24 × −0.0075
20
10
0
0 − 0 × −0.5625


 
 
=
 
 






20.219
20
10
0
0



.


We are then in a position to use Excel to solve equation (26), which yields the
solution vector at time half a year after option issue as

 

f (2, 1)
19.27
 f (2, 2)   9.42 

 

 f (2, 3)  =  1.00  .

 

 f (2, 4)   0.17 
f (2, 5)
0.04
1
The matrix is tri-diagonal: it has non-zero entries along the main diagonal (from top left to
bottom right) and non-zero entries along the diagonal above and the below this main diagonal,
while has zero entries in all other positions.
Published by ePublications@bond, 2016
13
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
Now that we have computed the values of the option at time step i = 2, the same
approach can be applied to computing the values at time step i = 1 (from the values
at time step i = 2).
In matrix form the equations to

b (1) c (1)
0
0
0
 a (2) b (2) c (2)
0
0

 0
a (3) b (3) c (3)
0

 0
0
a (4) b (4) c (4)
0
0
0
a (5) b (5)
solve equation (15) for i = 1 are
 
 
f (1, 1)
f (2, 1) − f (1, 0) a (1)
  f (1, 2)  
f (2, 2)
 
 
 ×  f (1, 3)  = 
f (2, 3)
 
 
  f (1, 4)  
f (2, 4)
f (1, 5)
f (2, 5) − f (1, 6) c (5)



=


f (2, 1)
f (2, 2)
f (2, 3)
f (2, 4)
f (2, 5)


 
 
−
 
 



 (27)


f (1, 0) a (1)
0
0
0
f (1, 6) c (5)



.


The vector on the right hand side of equation (27) can be computed numerically,
which is (19.49, 9.42, 1.00, 0.17, 0.14), as we now have all the information we need.
The solution, written in matrix notation, is then






f (1, 1)
f (1, 2)
f (1, 3)
f (1, 4)
f (1, 5)


 
 
=
 
 
1.065 −0.0325
0
0
0
−0.055 1.185 −0.105
0
0
0
−0.1425 1.385 −0.2175
0
0
0
−0.270 1.665 −0.37
0
0
0
−0.4375 2.025
−1








×


19.49
9.42
1.00
0.17
0.04






and can be solved in Excel to give the values at time step i = 1 of

 

f (1, 1)
18.57
 f (1, 2)   8.96 

 

 f (1, 3)  =  1.70  .

 

 f (1, 4)   0.40 
f (1, 5)
0.10
With the option values at time step i = 1, we can calculate the values of the option
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
14
Kyng et al.: Finite difference methods for option pricing in excel
at time step at time step i = 0 using the same approach, giving

 

f (0, 1)
17.90
 f (0, 2)   8.59 

 

 f (0, 3)  =  2.22  ,

 

 f (0, 4)   0.64 
f (0, 5)
0.19
and it is f (0, 3), at a stock price of $30, which we originally sought.
The above simplified numerical example explains the ideas behind the implicit
finite difference method. We can formalise this solution method as follows: starting
with a grid consisting of M increments in the stock price and N time increments,
we calculate boundary conditions to give the top, bottom and rightmost values of
the grid. Then, at each (backwards) time step we have a set of M − 1 simultaneous
equations to solve via a matrix approach
A × fi = (fi+1 − di ) ,
(28)




f (i, 1)
f (i, 0) a (1)




f (i, 2)
0




 and di = 
 are both vectors of
...
...
where fi = 




 f (i, M − 2) 


0
f (i, M − 1)
f (i, M ) c (M − 1)
dimension M − 1 and


b (1) c (1)
0
0
0
...
0
 a (2) b (2) c (2)

0
0
...
0


 0

a (3) b (3)
c (3)
0
...
0


 0

0
a
(4)
b
(4)
c
(4)
...
0
A=
 (29)
 ..

..
 .

.
...
...
...
...
0


 0

0
... a (M − 2) b (M − 2) c (M − 2)
0
0
0
0
...
0
a (M − 1) b (M − 1)
is an (M − 1) × (M − 1) tri-diagonal square matrix. The solution is fi = A−1 ×
(fi+1 − di ), which gives the vector of option values at time step i in terms of those at
time step i + 1. We apply this equation using backward recursion working through
the N − 1 backwards time steps from i = N − 1 through to i = 0 to obtain the
option price at time 0. It is possible to program this approach into Excel. To do so,
Published by ePublications@bond, 2016
15
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
matrix calculations in Excel are required—in particular, matrix inversion, matrix
multiplication, and addition and subtraction of vectors.
It can be shown that, under certain conditions, if we let the M and N get bigger
then the above method will converge to the correct option value at time 0. We
comment further on issues of stability and accuracy in section 2.4 below.
The matrix A in equation (28) is a tri-diagonal matrix and the solution fi requires
calculation of the inverse of this matrix. Fortunately, there is a very efficient algorithm for computing the solution of equations such as (28), known as the Thomas
Algorithm. We can compute the solution easily using this algorithm and it can
handle very large matrices. This is covered in section 2.4 of Press et al. (2007).
However the algorithm is not built into Excel whereas matrix inversion is, and for
purposes of exposition with Excel we have used matrix calculations instead of the
Thomas algorithm.
2.3
Explicit Finite Difference Approach
The explicit finite difference method is an alternative to the implicit finite difference approach discussed above. It has the advantage that there are no simultaneous
equations that need to be solved. Its disadvantage, though, is that, relative to the
implicit finite difference method, it converges to a solution at a slower rate.
The explicit approach initially proceeds in much the same way as the implicit
approach. We begin, however, with a different set of approximations to the partial
derivatives that we chose for the implicit method, discussed above equation (14),
specifically
f (i + 1, j) − f (i, j)
∂F
≈
,
(30)
∂t
∆T
∂F
f (i + 1, j + 1) − f (i + 1, j − 1)
≈
(31)
∂S
2 · ∆S
and
∂ 2F
f (i + 1, j + 1) + f (i + 1, j − 1) − 2f (i + 1, j)
≈
.
∂S 2
(∆S)2
(32)
Compared with the implicit approach, we use information at time t + 1 rather than
at time t to approximate the first and second derivatives of F with respect to S in
the explicit approach, which could cause lower accuracy due to introduced errors.
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
16
Kyng et al.: Finite difference methods for option pricing in excel
Substitute (30)–(32) into the PDE of Black-Scholes model2 (1):
0 =
f (i + 1, j) − f (i, j)
∆T
f (i + 1, j + 1) − f (i + 1, j − 1)
+ (r − y) · j · ∆S
2 · ∆S
1 2 2
2 f (i + 1, j + 1) + f (i + 1, j − 1) − 2f (i + 1, j)
+ σ j · (∆S)
2
(∆S)2
−r · f (i, j) .
(33)
We can multiply (33) by ∆T throughout and collect together the terms involving
f (i + 1, j − 1) , f (i + 1, j) , f (i + 1, j + 1) and f (i, j) yielding
0 = f (i + 1, j) − σ 2 j 2 ∆T · f (i + 1, j)
−f (i, j) − r · f (i, j) ∆T
1
1
+ (r − y) · j · ∆T · f (i + 1, j + 1) + σ 2 j 2 f (i + 1, j + 1) ∆T
2
2
1
1
− (r − y) · j · ∆T · f (i + 1, j − 1) + σ 2 j 2 f (i + 1, j − 1) ∆T,
2
2
which can be rewritten as
− 12 (r − y) · j · ∆T · + 21 σ 2 j 2 ∆T
f (i, j) = f (i + 1, j − 1) ×
1 + r · ∆T
2 2
1 − σ j ∆T
+f (i + 1, j) ×
1 + r · ∆T
1
(r − y) · j · ∆T · + 21 σ 2 j 2 ∆T
2
.
+f (i + 1, j + 1) ×
1 + r · ∆T
(34)
Indeed, equation (34) can be re-expressed in a form similar to the implicit method
equation (15), with
f (i, j) = f (i + 1, j − 1) × a∗j + f (i + 1, j) × b∗j + f (i + 1, j + 1) × c∗j ,
2
(35)
2
Note that the ∆S, (∆S) terms in this expression cancel out.
Published by ePublications@bond, 2016
17
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
where
− 21 (r − y) · j · ∆T · + 21 σ 2 j 2 ∆T
=
1 + r · ∆T
2 2
1
−
σ
j
∆T
b∗j =
1 + r · ∆T
1
(r − y) · j · ∆T · + 21 σ 2 j 2 ∆T
.
c∗j = 2
1 + r · ∆T
This is another backwards recursion formula and is represented diagrammatically
in figure 3. Comparing figures 2 and 3 one can see it is different from the implicit
finite difference method; it relates the value of the function at time step i with
the three different values of the function f at time step i + 1. This relationship
means the method is easier to implement, as it does not require the solution of a set
of simultaneous equations. That is, with the explicit finite difference method, we
can proceed backwards from the terminal time f values to the initial time f values
simply by use of the recursive equation (35).
a∗j
2.4
Stability and Accuracy
The finite difference methods treated above are stable and accurate—under certain
circumstances. Indeed, the remarkable Lax Equivalence Theorem tells us that for
a well-posed PDE, a convergent numerical approximation scheme will get us to its
true solution—as long as the scheme is stable (Duffy, 2006). These next paragraphs
outline what is meant by each of these technical terms: well-posed, convergent
numerical scheme and stability.
Initially one needs to determine whether the mathematical problem for which a
solution is sought not only has a solution, but also whether that solution is “easy
to find”. Such a problem is known as well-posed, and these problems typically have
a solution that changes little as one moves around its vicinity in ‘small’ steps (Lucchetti, 2006). Mathematicians term this “stable under small perturbations”. That
our option pricing problems are well-posed is intuitively obvious: the underlying
economics tells us there is going to be only one price for the option contract at a
particular point in time and this price will change smoothly in response to small
changes in economic conditions.
A numerical scheme is known as convergent if, as the meshsize and the step sizes—
or time-marching sizes—decrease, the finite difference scheme gets closer and closer
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
18
Kyng et al.: Finite difference methods for option pricing in excel
𝐒𝐦𝐢𝐧
𝟎
𝚫𝑻
𝟐𝚫𝑻
𝟑𝚫𝑻
𝟒𝚫𝑻
𝟓𝚫𝑻
0
1
2
3
4
5
𝟔𝚫𝑻
6
(N)
𝒕
i
0
𝐒𝐦𝐢𝐧 + 𝚫𝑺
1
𝐒𝐦𝐢𝐧 + 𝟐𝚫𝑺
2
𝐒𝐦𝐢𝐧 + 𝟑𝚫𝑺
3
𝐒𝐦𝐢𝐧 + 𝟒𝚫𝑺
4
𝐒𝐦𝐢𝐧 + 𝟓𝚫𝑺
5
𝚫𝑺
𝐒𝐦𝐚𝐱
6
(M)
𝑺
j
𝚫𝑻
Figure 3: Explicit finite difference method on the grid. This is a graphical
representation of equation (35). One sees the link between the option value at stock
price S = j∆S and time t = i∆T with the nodes at time t = (i + 1)∆T and
neighbouring stock prices. Our solution method proceeds backwards in time. As it
does so, nodes at time i∆T are determined by the option values at time (i + 1)∆t.
Thus, values are entirely determined by their preceding neighbouring values, and so
we term the method explicit.
Published by ePublications@bond, 2016
19
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
Table 5: Percentage errors in pricing a European put option using the
implicit finite difference scheme and parameter values from table 1, apart
from M and N values, which vary.
M =5
M = 10
M = 15
M = 20
M = 200
N =5
22.5
10.0
0.8
4.9
3.4
N = 10
23.1
8.0
0.8
3.1
1.7
N = 15
23.3
7.3
1.2
2.6
1.1
N = 20
23.4
6.9
1.6
2.3
0.9
N = 200
23.7
6.0
2.3
1.5
0.1
to the differential equation it is trying to approximate (Shapira, 2006). Thus, we
have chosen a good discretisation of the problem under consideration. This is also
the case for the explicit and implicit finite difference schemes to determine option
prices above. As step sizes get smaller our approximations to the derivatives get
better and better. In each of tables 5, 6 and 7 we see, broadly, improved accuracy as
M and N increase, reflecting the good convergence properties of the solution method.
Further, we can observe parameter effects in tables 6 and 7. The situation with a
more in-the-money option (table 6) has led to faster convergence. The situation with
less market volatility (table 7), on the other hand, has led to slower convergence.
Table 6: Percentage errors in pricing a European put option using the
implicit finite difference scheme and parameter values from table 1, apart
from M and N values, which vary, and S, which is set at 25 (the option
is in-the-money).
M =5
M = 10
M = 15
M = 20
M = 200
N =5
4.6
1.1
0.6
0.5
0.7
N = 10
4.6
0.9
0.9
0.2
0.4
N = 15
4.6
0.8
1.0
0.0
0.3
N = 20
4.6
0.8
1.1
0.0
0.2
N = 200
4.6
0.6
1.2
0.1
0.0
Moving from the problem under consideration to focus on the approximation
method we adopt, we find ideas of stability are also important. Key to any approximation method are its stability characteristics (Hackbusch, 2014). The stability
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
20
Kyng et al.: Finite difference methods for option pricing in excel
Table 7: Percentage errors in pricing a European put option using the
implicit finite difference scheme and parameter values from table 1, apart
from M and N values, which vary, and σ, which is set at 0.1 (stock prices
are less volatile than table 1 values).
M =5
M = 10
M = 15
M = 20
M = 200
N =5
664.4
242.5
76.8
100.0
2.4
N = 10
660.6
246.7
72.3
100.0
1.5
N = 15
659.4
248.1
70.7
100.0
1.2
N = 20
658.7
248.8
69.9
100.0
1.1
N = 200
657.0
250.9
67.8
100.0
0.8
characteristics of an implemented approximation method refer to the impact that
small errors in the method have on results. If such small errors can produce big
fluctuations in results—moving the approximate solution far away from the true
solution—then the method has poor stability, and is of little value to us. The underlying mathematics of a finite difference scheme will suggest conditions that need
to be satisfied for the scheme to be stable (John, 1982). Indeed, it can be shown that
the explicit finite difference scheme is only stable if 0 < ∆T /(∆S)2 ≤ 1/2, while
the implicit finite difference scheme is stable for any ∆T /(∆S)2 > 0 (Wilmott,
Dewynne and Howison, 1993). Thus, stability and accuracy of these two finite difference methods requires these conditions being satisfied—for small enough values
of ∆T and ∆S. And this is one of the reasons for the development of implicit finite
difference methods. Such methods can achieve convergence without the efficiency
loss implied by the extremely small time steps an explicit method may require for
stability.
3
3.1
Excel Implementation
Implicit Finite Difference Method for Pricing an European Put and Call Option and an American Put Option
We firstly illustrate the Excel implementation of the implicit finite difference
method for a European put option.
Published by ePublications@bond, 2016
21
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
Figure 4: Parameters used in the Excel implementation of the implicit
finite difference method for a European put option. These are a subset of
the values given in table 1 of section 2.1 above.
The parameters for our implementation of the implicit finite difference method
are set out in the cell range A6:A17 of our spreadsheet, as shown in figure 4 below.
We are using N = 3 time increments and M = 6 stock price increments. The stock
price increment is $10 and the stock prices range from $0 to $60. The time increment
is 0.25 years and the times range from 0.00 to 0.75 years, going up in these steps of
size 0.25 years. Using the closed form solution of the Black-Scholes model from (11)
for this European put option, we found the option has a value of $2.98.
Following the steps outlined in Section 2.1, we need to create a table for stock
prices and a table for the option values at these different stock prices. Those Excel
tables are indexed by a column index i for time and a row index j for price. In the
spreadsheet we create Excel table 2 for the stock price and Excel table 3 for the
option values for boundary conditions: (8), (12) and (13), which are shown in figure
5.
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
22
Kyng et al.: Finite difference methods for option pricing in excel
Figure 5: Stock prices and boundary conditions produced by our modelling. The Excel tables reflect the modelling done in tables 2 and 3 of section 2.1
above.
For Excel table 2, the Excel code in cell F7 is =$A$12+$E7*$A$14 and we can
copy this cell to F7:I13 to produce the stock prices. For Excel table 3, the Excel
code in cell I19 is =MAX($A$7-I7,0) and we can copy this cell to I19:I25 for the
option values using boundary condition (8). Then we input =$A$7*EXP(-($A$9F$18)*$A$15*$A$16)-F7*EXP(-($A$9-F$18)*$A$15*$A$17) in F19. We can then
copy that to the range F19:H19 to compute the option values using boundary condition (13). In cells F25:H25, we input number zero in for the option values in
accordance with boundary condition (12).
In our spreadsheet we set up Excel tables 4 and 5 for the computation of the
coefficients a(j), b(j) and c(j), from (15), and the tri-diagonal matrix A, from
(29), which are shown in figure 6. The Excel code in cell F31 is =0.5*($A$16$A$17)*E31*$A$15-0.5*$A$18ˆ2*E31ˆ2*$A$15 and we copy cell it to F32:F37 to
compute all a(j) coefficients. The Excel code in cell G31 is =1+$A$18ˆ2*E31ˆ2*$A$15
Published by ePublications@bond, 2016
23
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
Figure 6: The coefficients in the difference equation and the tri-diagonal
matrix. These are produced by our modelling in tables 4 of section 2.2 and subsequent discussion. The coefficients are given by equations (16)–(18) above; matrix
A by equation (29).
+$A$16*$A$15 and we copy it to G32:G37 to compute all b(j) coefficients. The
Excel code in cell H31 is =-0.5*($A$16-$A$17)*E31*$A$15-0.5*$A$18ˆ2*E31ˆ2*$A$15
and we can copy it to H32:H37 to compute all c(j) coefficients. In Excel table 4,
we input coefficient values from Excel table 5 based on (29). The numbers in bold
on the top edge of table 5 are the i values, the column index, and the numbers in
bold on the left edge are the j values, the row index, for the matrix.
Now we start to compute the option prices using backward recursion and the
matrix formula fi = A−1 × (fi+1 − di ). Following the definition of the di , given after
equation (28), the adjustment vectors are calculated in Excel table 6—see figure 7
below. In the cell F50, we input the Excel code =F19*$F$32 and we can copy it to
G50:H50 to compute the first entries in each of the other adjustment vectors. Cell
F54 contains the Excel code =F25*$H$36; copy it to G54:H54.
Excel table 7, shown in figure 7, gives the option values at the interior points of the
grid. Firstly, we select the cell range range H59:H63 and enter code for the matrix
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
24
Kyng et al.: Finite difference methods for option pricing in excel
Figure 7: Tables of adjustment vectors di and option value vectors fi . Details
of these vectors appear immediately after equation (28). The bold entry is f (0, 3),
the European put option price given by this toy implicit scheme at initiation if the
stock price at that time is $30, which is what we sought.
calculation =MMULT(MINVERSE($F$42:$J$46),(I59:I63-H50:H54)). Recall that
$F$42:$J$46 is our tri-diagonal matrix A, appearing in figure 6 above and defined
in equation (29). Then we hold down both the control and the shift keys while
pressing the enter key to finish the formula input for this matrix. The combination
of the control, shift and enter keys is required to create a matrix formula in Excel.
This code implements the calculation for the case i = 2, which is one time step before
maturity. We copy the code for the matrix calculation to G59:G63 and repeat the
previous step of pressing these three keys simultaneously to compute the option price
vector at time 1. Finally, we copy the code for the matrix calculation to F59:F63
and repeat the previous step to obtain option values at time 0. Implementing this
in Excel is cumbersome for large M and N and in industrial practice the finite
difference methods would be implemented in some other software package, using the
Thomas Algorithm for solving equation (28) as explained above.
We find the option price we want in the third entry of the option price vector
Published by ePublications@bond, 2016
25
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
at time 0. Using the implicit finite difference method, we calculate option price of
2.22. Compared to the analytic solution from the Black-Scholes model, 2.98, our
finite difference implementation with N = 3 and M = 6 is not very accurate. The
ratio of the finite difference method price to the analytic price is 74.24%.
However, here we only used a small-sized grid as a demonstration. If we repeat
the method with higher values of N and M , we get more accurate results. Using
N = 8, M = 10, we get a European put option price of 2.73 which is 91.53% of
the analytic solution. With even greater grid size, N = 25, M = 30, we obtain the
European put option value of 2.95 which has an accuracy ratio of 98.75%.
It is easy to modify the code for pricing a European call option. So far we have
set up the Excel code for pricing a European put option with N = 3 and M = 6.
We need to change the boundary conditions (2)–(4) in Excel table 3 to those of a
European call option. Modified Excel tables 3, 6 and 7 are shown in figure 8.
Excel tables 2, 4 and 5 do not change—the Excel code is same for those tables as
for the put option. The call option value is $4.36 using the finite difference method,
but $5.15 using the analytic formula.
Lastly, using the same parameters, we use the Excel spreadsheet to price an
American style put option. Most of the code and tables we have developed
for the European put option can be reused for this purpose. Changes are made in
Excel table 7, shown in figure 9. The Excel code in cell range F59:M63 is different now, as it takes account of the possibility of early exercise. The code in cell F59 is
=MAX(INDEX(MMULT(MINVERSE($F$42:$J$46),(G$59:G$63-F$50:F$54)),$E59),
MAX($A$7-F8,0)).
The INDEX function picks out the correct element of the vector of option prices
from the matrix calculation. The MAX function chooses the higher of either the
early exercise value or the value assuming we do not exercise early. This produces
a higher overall valuation. We then copy cell F59 to F59:H63 to compute all the
other option values in the interior of the grid. The numerical results are, typically,
greater than our results for the European put.
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
26
Kyng et al.: Finite difference methods for option pricing in excel
Figure 8: Implicit finite difference method (N = 3, M = 6) for a European
call option. To switch from a put to call option we have to modify the values of
f (i, j) along the boundary of the grid to reflect the call option boundary conditions
given in equations (2)–(4) in section 2 above. Then we follow through the implicit
scheme methodology with this revised grid boundary. The bold entry is f (0, 3), the
call option price at contract initiation if the stock price, at that time, is $30.
Published by ePublications@bond, 2016
27
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
Figure 9: Implicit finite difference method (N = 3, M = 6) for a American
put option. Here the cell formulæ of figure 7 above are altered to allow for the
possibility of early exercise. Compared to the European put option price results in
figure 7, we see the American put option prices are never smaller, and often larger.
3.2
Explicit Finite Difference Method for Pricing an European Put Option and an American Put Option
The Excel implementation of the explicit finite difference method is easier—
it does not require manipulations of a tri-diagonal matrix, as can be seen from
difference equation (35). We illustrate the way to use the explicit method to price
a European put option below. The parameters for the valuation are in cell range
A4:B16 and the coefficients a∗ (j), b∗ (j) and c∗ (j) are in cell range E4:H15 in figure
10.
In figure 10, the Excel code in cells F5, G5 and H5 is
=(-0.5*$B$11*$B$10*$E5+0.5*$B$12ˆ2*$B$10*$E5ˆ2)/(1+$B$11*$B$10),
=1/(1+$B$11*$B$10)*(1-$B$12ˆ2*$E5ˆ2*$B$10) and =(0.5*$B$11*$B$10*$E5
+0.5*$B$12ˆ2*$B$10*$E5ˆ2)/(1+$B$11*$B$10), respectively. We copy F5:H5 to
F6:H15.
The grid of option prices and the boundary conditions is shown in figure 11. In
A23:B28 we show the details of the analytic Black-Scholes valuation of the European
put option. The details of the explicit finite difference method calculations of the
option price are in the cell range D19:N32.
Cell range F20:N20 shows the time steps and the cell range F21:N21 shows the
time remaining to maturity for these time steps. The cell range D22:D32 shows
the values of the (price) index j and the cell range E22:E32 show the values of the
stock price corresponding to these index values. From boundary condition (12), we
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
28
Kyng et al.: Finite difference methods for option pricing in excel
Figure 10: Parameter and coefficient values used in applying the explicit
finite difference method to pricing a European put option. Note that our
explicit method example uses different parameter values to the implicit method
example above. The mathematical detail of coefficients a∗ (j), b∗ (j) and c∗ (j) is
given in the discussion immediately following equation (35) above.
put 0 in F32:M32. With boundary condition (8) at maturity, we put =MAX($B$5$D22*$B$8,0) in cell N22 and copy it to N23:N32. Based on boundary condition (13), we put =$B$5*EXP(-($B$15-F$20)*$B$10*$B$11)-$E22*EXP(-($B$15F$20)*$B$10*$B$13) in F22 and copy it to G22:M22.
To compute the option values in F23:M31, we enter the formula =MMULT($F6:$H6,
N22:N24) into cell M23 and then copy cell M23 to the cell range F23:M31. This formula implements the backwards recursion for the explicit finite difference method.
The cell F27 contains the option price at time step i = 0 for stock price step j = 5.
For stock price of 20.00 the option price is 1.98, which is quite close to the analytic
value of 2.01.
Next we show how to modify our explicit method for an European put option to
price an American put option. We use same parameters as for the European put
option.
For the American put option, the calculations for coefficients and option values
at boundary conditions (8), (12) and (13) are the same as for the European one.
Published by ePublications@bond, 2016
29
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
Figure 11: Option prices for the explicit finite difference method for pricing
a European put option. At a current market price of the underlying asset of $20,
and market and contractual conditions outlined in figure 10 above, the bolded cell
on the left (B27) gives the theoretical value of the European put option price. The
boxed and bolded cell to its right (F27) is our approximation to this European put
option price.
This is shown in figure 12.
We put Excel code =MAX(MAX($B$5-$D23*$B$8,0),MMULT($F6:$H6,N22:N24))
in M23. This computes the value of the option for the time step i = 7 (one time
unit before maturity) and for the stock price S=$4. This Excel code computes the
higher of the early exercise price and the price computed using the explicit finite
difference method.
We then copy the formula Excel code in M23 to F23:M31 to automatically compute the other option values. The American option value at time 0 for stock price
$20.00 is $2.06 based on these calculations. This is higher than the value of the
equivalent European option, as it should be.
We have now shown how to implement both the implicit and explicit finite difference methods using Excel. Excel may not be the most suitable software package
for implementation of these methods in industrial practice. However, as many students and industry practitioners in the financial industry use Excel and understand
it well, this implementation may aid their understanding of how the method works,
and assist in the creation of software for implementing it more efficiently, as well as
providing a check on the results.
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
30
Kyng et al.: Finite difference methods for option pricing in excel
Figure 12: Option prices for the explicit finite difference method of pricing
an American put option. The cell formulæ of figure 11 above are altered to allow
for the possibility of early exercise. Compared to the European put option price
results in figure 11, we see the American put option prices are never smaller, and
often larger.
4
Conclusion
We have explained above how we can convert the PDE for an option price together
with its boundary condition into a difference equation by using finite difference
approximations to the derivatives within the PDE. We have also shown how the
difference equation can be solved and presented an Excel implementation of the
solution to the difference equation. This paper is based on our classroom experience
of teaching senior actuarial and finance students about the finite difference method
and how it can be used to provide an approximate valuation of options. We were
using the well known textbook Hull (2012) for the course we were teaching.
In our experience most finance and actuarial students find the exposition of this
topic via an Excel implementation to be an easy way to learn both the underlying
ideas and their implementation. We acknowledge that Excel is not the most appropriate software to use for an industrial application of the finite difference methods.
However, most of our finance and actuarial students have Excel expertise but lack
expertise in PDE theory and in other software tools. Using Excel to implement
Published by ePublications@bond, 2016
31
Spreadsheets in Education (eJSiE), Vol. 9, Iss. 3 [2016], Art. 2
the methods has pedagogical benefits compared to other software tools—students
can see how the method works on the computer screen and the inputs, intermediate
calculations and final results are all displayed to the user. This works well for small
scale examples and makes the method much easier to understand. This enhances
student learning of the material and eliminates blockages to learning due to the difficulty of implementation via pen, paper and calculator or via other, more opaque,
software packages.
References
Andreasen, Jesper, Bjarke Jensen and Roy Poulsen. 1998. “Eight valuation methods
in financial mathematics: the Black-Scholes formula as an example.” Mathematical
Scientist 23(1):18–40.
Black, Fischer and Myron Scholes. 1973. “The Pricing of Options and Corporate
Liabilities.” The Journal of Political Economy 81(3):637–654.
Boyle, Phelim P. 1986. “Option valuation using a three-jump process.” International
Options Journal 3(1):7–12.
Cox, John C., Stephen A. Ross and Mark Rubinstein. 1979. “Option pricing: A
simplified approach.” Journal of Financial Economics 7(3):229–263.
Duffy, Daniel J. 2006. Finite Difference Methods in Financial Engineering : A
Partial Differential Equation Approach. John Wiley & Sons, Ltd.
Hackbusch, Wolfgang. 2014. The Concept of Stability in Numerical Mathematics.
Springer Series in Computation Mathematics 45 Berlin: Springer-Verlag.
Hull, John. 2012. Options, Futures and Other Derivatives. 8th ed. Englewood Cliffs,
NJ, USA: Prentice Hall.
John, Fritz. 1982. Partial Differential Equations. Applied Mathematical Sciences 1
4th ed. Springer-Verlag.
Lucchetti, Roberto. 2006. Convexity and Well-Posed Problems. CMS Books in
Mathematics Springer-Verlag.
http://epublications.bond.edu.au/ejsie/vol9/iss3/2
32
Kyng et al.: Finite difference methods for option pricing in excel
Press, William H., Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery.
2007. Numerical Recipes : The Art of Scientific Computing. 3rd ed. Cambridge
University Press.
Shapira, Yair. 2006. Solving PDEs in C++ : Numerical Methods in a Unified
Object-Oriented Approach. SIAM.
Wilmott, Paul. 2013. Paul Wilmott on Quantitative Finance. John Wiley & Sons.
Wilmott, Paul, Jeff Dewynne and Sam Howison. 1993. Option Pricing: Mathematical Models and Computation. Oxford Financial Press.
Wilmott, Paul, Sam Howison and Jeff Dewynne. 1995. The mathematics of financial
derivatives: a student introduction. Cambridge University Press.
Published by ePublications@bond, 2016
33