Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
CS 335 Assignment
Submit all components of your solutions (written/analytical work, code/scripts/notebooks, figures,
plots, etc.) to CrowdMark in PDF form in the section for each question.
You must also separately submit a single zip file containing any and all code/notebooks/scripts you
write to the A2 DropBox on LEARN, in runnable format (that is, .ipynb).
For full marks, you must show your work and adequately explain your logic!
1. (15 marks) Option pricing using a binomial lattice.
Coding: Develop Jupyter/Python code for pricing European and American options, of both
put and call type, using a binomial lattice. Use the lattice parameters for the no-arbitrage
lattice, as described for example in Section 3.2 of the course notes (and in lectures). For this
question, you do not need to apply smoothing of the payoff.
Your code should be vectorized so that there is only one explicit for loop over the timesteps (i.e.,
no for loops over vector entries within one timestep). See Section 3.5 of the course notes for hints
on how to proceed. Also, your code should take only O(N) storage, NOT O(N2). That is, do
not store data for the whole tree at once, but rather data for one or two columns at a time. In the
American case, ensure that you compute the payoff at each time step using vector operations;
this will require determining/knowing the vector of stock prices for that time/column.
Test your code for European put/call options code by using the data in Table 1 below.
0 , 0) (for both puts and calls) as a function
of ∆t. Start off with 500 timesteps (i.e., ∆t = T/500), and then repeat the process doubling the
number of timesteps, i.e., 1000, 2000, . . . 8000, timesteps. You should expect to see your results
converging towards the exact solution value. Your tables be structured roughly like Table 2 (but
you do not need to make fancy borders - just rows of text is fine). Your table should also show
the exact (blsprice) value for comparison (where available).
σ 0.32
r 0.04
Time to expiry 1 year
Strike price K $100
Initial asset price S00 $100
Table 1: Some typical option parameters
If V exact is the exact price, and V tree is the price from a lattice pricer, then it is possible to
prove that
V tree∆t (S, t) = V
exact(S, t) + C(S, t)∆t+O((∆t)2), (1)
1
∆t Value Change Ratio
T/500 V∆t1
T/1000 V∆t2 V∆t2 − V∆t1
T/2000 V∆t3 V∆t3 − V∆t2 V∆t2−V∆t1V∆t3−V∆t2
...
...
...
...
exact V exact
Table 2: Convergence Test
where C(S, t) is independent of ∆t. Estimate (by hand calculation using the above formula)
lim
∆t→0
V tree∆t/2(S
0
0 , 0)− V tree∆t (S00 , 0)
V tree∆t/4(S
0
0 , 0)− V tree∆t/2(S00 , 0)
. (2)
What order of accuracy does the convergence data table you generated indicate our lattice
method is likely exhibiting? Does this agree with the theory above?
Next, repeat the above tests for an American put (no analytic solution available), using the
data in Table 1. Show a convergence table as in Table 2 (but without the exact solution).
2. (5 marks) Smoothing the Payoff.
In this question, we consider a variant of a put option known as a digital put option. Such an
option is characterized by a strike price K and a payoff according to
Payoff =
{
1 if K > S,
0 otherwise.
where (as usual) S is the stock value. Determine the expressions for the smoothed digital put
payoff in this case. You should use the same smoothing strategy as covered in the lecture (which
will, of course, have to be modified for a digital put).
3. (10 marks) Binomial lattice.
A binomial lattice is given with the properties
S(t+ ∆t) =
{
S(t)u with probability p
S(t)d with probability 1− p,
where
u = eσ
√
∆t, d = 1/u, p =
er∆t − e−σ
√
∆t
eσ
√
∆t − e−σ
√
∆t
,
over the time interval ∆t.
(a) Show that
E[S(t+ ∆t)|S(t)] = S(t)er∆t ,
where E[·] is the expectation.
2
(b) Show that
V ar[S(t+ ∆t)|S(t)] = S(t)2 [σ2∆t+O(∆t2)] ,
where V ar is the variance. Hint: the Taylor expansion of ex is
ex = 1 + x+
x2
2!
+
x3
3!
+ ...+
xn
n!
+ ... x→ 0.
4. (8 marks) Lattice properties.
Let Cnj be the value of a European call option at node (j, n), obtained using a no-arbitrage
lattice. Likewise, let Pnj be the value of a European put option at node (j, n), obtained using a
no-arbitrage lattice. Assume that Pnj and C
n
j both have the same strike price K, are based on
the same underlying stock S, and have expiry time T = N∆t. Show that
Cnj − Pnj +Ke−(N−n)r∆t = Snj . (3)
This is a discrete version of what is called put-call parity.
Hint: Induction is often useful for understanding lattices, and that is the case here as well.
Work backwards from the expiry time (i.e., column N in the lattice) and use the rules that
define the relationships between S at adjacent timesteps, and likewise for the option price V at
adjacent timesteps (in this case we have used C or P rather than V to distinguish the two types
of options, but the update rule remains the same).
5. (8 marks) Dynamic Programming.
Consider the following game. You are given a fair five-sided die, with faces {0, 1, 2, 3, 4}. You
can roll the die, and obtain a payoff equal to the value shown on the die, or you can choose to
roll again. Note that if you choose to roll again, you can only get the new payoff or roll again.
You can roll the die up to three times. You must pay $1.4 for the first roll, $1.05 for a second
roll, and $0.85. for a third roll. You pay only for the rolls you choose to take, and get no money
back if you move onto the next roll. What is your expected gain, assuming you were to behave
optimally at each step? (Hint: this is somewhat similar to the marriage problem we looked at
in lecture. Use dynamic programming; i.e., work backwards from the last roll!)
Work this out manually, i.e., you do not need to write or run any code here.