HW 1
HW 1
HW 1
(a) (3 marks) Construct a risk-free portfolio and use it to determine the present no-arbitrage
value (fair value) of the option (i.e., at time t = 0).
(b) (3 marks) Suppose such an option is priced on the market at V ∗ = 2.0 (i.e., higher than
the no-arbitrage price). Describe the details for a strategy that will result in a guaranteed
profit (in present value, i.e., at t = 0) and determine the value of that profit (per option),
somewhat similar to what we did in class. (As usual in this course, we will assume short-
selling is allowed and the no-arbitrage principle holds.)
dX = α dt + σ dZ ,
as ∆t → 0. The exact solution to this SDE is such that the exact density (probability
√ distribu-
tion) of X(T ) is a normal density with mean Xinit + αT and standard deviation σ T , assuming
the initial value of X is Xinit .
Verify this experimentally via numerical simulation of many lattice walks, by preparing a
Jupyter/Python notebook to carry out the following. Perform a lattice walk simulation, us-
ing the parameters given in Table 1. Starting at X0 = Xinit , the value of X is then moved up
with probability p or down with probability (1 − p). A uniformly distributed random number
1
on [0, 1] should be generated and used to determine the actual move taken. At the next lattice
node (i.e., time step), this process is repeated, until we obtain the final position of X after N
steps, XN , at t = T . This is a single simulation outcome; we perform many such simulations
to produce many (possibly) different outcomes. Because each step moves up or down a fixed
amount, the set of all possible outcomes for this discrete lattice walk is
√
j
XN = Xinit + (2j − N )σ ∆t j = 0, . . . , N.
As indicated in Table 1, you should perform the above process first for 1000 simulations, then
separately for 10,000 simulations, and finally for 100,000 simulations. In each case, print out
the number of simulations and the corresponding mean and standard deviation of the computed
values of XN from the simulations in that set. Also, print out the anticipated exact mean and
standard deviation for comparison.
Next, for each set of simulations, we would like to generate a histogram of the observed probability
density versus X(T ) as described below.
Care must be taken in scaling this histogram to get the correct probability density. Let p(x) be
the probability density, and let bin[a,b] be the bin on an interval [a, b] of the x axis. Then
Z b
p(x) dx ' p((a + b)/2)(b − a)
a
Number of occurrences in bin[a,b]
'
Total number of occurrences
so that
1 Number of occurrences in bin[a,b]
p((a + b)/2) '
(b − a) Total number of occurrences
Use N +1 bins, with the bin boundaries falling half-way between the lattice nodes at timestep N .
Use matplotlib’s bar function to display your probability density plot constructed as described
above. (Alternatively, if you prefer, Matplotlib’s hist or Numpy’s histogram functionality can
automate some of this process, if you give it appropriately chosen values for the range, bin width,
and density parameters.) Be sure to include appropriate labeling on your plots (axis labels, title,
legend if necessary).
Then, for comparison, over top of each of your histograms, generate a standard
√ (line) plot of
the true normal distribution with mean Xinit + αT and standard deviation σ T , over the same
range (in a different color). The Scipy function stats.norm.pdf can be used to evaluate a true
normal distribution function. Thus each of your three plots will look something roughly along
the lines of Figure 1 (albeit generated with different data).
Your code must be vectorized for efficiency, i.e., prefer vector operations instead of scalar oper-
ations. As a very simple example of vectorization, if I have a Numpy vector V and I want to
add 1 to every entry of the vector, I can simply write the vector operation V = V + 1, instead
of using a slower for loop over index i and separately computing V [i] = V [i] + 1 for each entry.
Similarly, many Numpy functions work on vectors rather than single numbers.
Specifically, your code for the lattice walk should only explicitly loop over the timesteps, not
over the individual simulations - for each time step, the updates for all the simulations (within a
set) should be computed together using vector operations. Also, you should not store the entire
2
Figure 1: A histogram of an approximate probability density function, with a normal distribution
plotted on top.
T 1.75
σ 0.3
α 0.4
Xinit 17
Number of simulations 1000, 10000, 100000
Number of timesteps (N ) 300
lattice at once, but rather only one or two columns of it, to save on memory. The example lattice
walk code in the course notes is likely to be very helpful, since it illustrates both vectorization
and lattice walk implementation! (Course notes, page 17).
In addition to the NumPy functions mentioned previously above, you may also find the mean,
std, and random.uniform functions useful.
In a markdown cell in your Jupyter notebook, describe what you observe about your results
(plots and statistics) as the number of simulations increases from 1000 to 100,000.
3
and
N
X −1
I(T, ∆t) = (∆Zi )2
i=0
T
∆t = .
N
Write a Jupyter/Python notebook to evaluate I(T, ∆t). For T = 2, for fixed ∆t, compute the
value of I(T, ∆t). Use 70000 paths, and compute the mean and variance of the result, for N =
100, 200, 400, 800, 1600, 3200, 6400 timesteps. Vectorize your code so that there is only one
explicit for loop over the timesteps, for a given value of N .
Write code to generate a simple text-based table of mean and variance of I(T, ∆t) for the different
values of ∆t. (No fancy formatting is required! You can just use Python’s print function to
generate each row, with appropriate arguments.)
Plot a graph of var(I(T, ∆t)) versus ∆t, with appropriate labels. In a markdown cell of your
Jupyter notebook, explain mathematically what you observe.
(a) (3 marks) Let X(t) and Y (t) be two stochastic processes, such that
with dZX (t), dZY (t) being the increments for two distinct Wiener processes, ZX (t) and ZY (t).
Let X(ti ) = Xi and Y (ti ) = Yi . Show that
Then, using the definition of the Ito integral which is the limit of a discrete sum, show that
Z t Z t Z t
t
X(s)dY (s) = [XY ]0 − Y (s)dX(s) − dX(s)dY (s).
0 0 0
√
(b) (2 marks) Let Z(t) be a stochastic differential equation satisfying dZ = φ dt, and assume
Z(0) = 0. Using the result in part (a), show that (assuming Ito calculus)
Z t
1 t
Z(s) dZ(s) = Z(t)2 − .
0 2 2
(c) (2 marks) We saw that in Ito calculus, an RIto integral is defined in terms of the limit
t
of a so-called “Ito’s sum”. For the integral 0 Z(s)dZ(s), the corresponding Ito’s sum is
PN −1
j=0 Z(tj )(Z(tj+1 ) − Z(tj )). Determine the expected value of this sum.
4
(a) (3 marks) If
as much as possible. The integral is to be interpreted in the Ito calculus sense. (Note that
σ(X(t), t) is a function of t, not a constant, so you will not be able to fully solve the integral.)