Docsity

Assignment 2 Solution - Data Science - Fall 2008 | CSCI 6961, Assignments of Computer Science

Toggle sidebar
bg1
CSCI 6961 RPI
Introduction to Computational Finance Fall 2008
ASSIGNMENT 2 Solutions
(25 (0) points) Bond Portfolio Immunization
Assume that you purchase α1, α2, α3of each bond, with expirys 0.25,0.5,1.0 year respectively.
The settlement constraint is
α1e−rt1+α2e−rt2+α3e−rt3= 1000e−rt .
The settlement constraint fixes one of the parameters. We thus need two more equations to
fix all the parameters. We can use these degrees of freedom to set two derivatives to zero.
(i.e., consider the time ∆tand an interest rate change ∆r. We will assume that ∆t→0.)
Setting the first and second derivatives to 0, we obtain two more equations:
α1t1e−rt1+α2t2e−rt2+α3t3e−rt3−1000te−rt = 0,
α1t2
1e−rt1+α2t2
2e−rt2+α3t2
3e−rt3−1000t2e−rt = 0.
Solving these three equations for the three unknowns αa, α2, α3gives
α1=Xe−r(t−t1)(t2−t)(t3−t)
(t2−t1)(t3−t1),
α2=Xe−r(t−t2)(t1−t)(t3−t)
(t1−t2)(t3−t2),
α3=Xe−r(t−t3)(t1−t)(t2−t)
(t1−t3)(t2−t3).
Plugging in the values of t, t1, t2, t3, we obtain
α1=−325.1033, α2= 987.5778, α3= 337.5262.
(25 (35) points) Exponential Moving Average
(a) For t= 1,...,N,
MV (t) = (1 −e−λ)
t
X
i=−∞
e−λ(t−i)Si.
For t < 1, MV (t) = 0.
1
pf2

Partial preview of the text

Download Assignment 2 Solution - Data Science - Fall 2008 | CSCI 6961 and more Assignments Computer Science in PDF only on Docsity!

CSCI 6961 RPI

Introduction to Computational Finance Fall 2008

ASSIGNMENT 2 Solutions

(25 (0) points) Bond Portfolio Immunization

Assume that you purchase α 1 , α 2 , α 3 of each bond, with expirys 0. 25 , 0. 5 , 1 .0 year respectively. The settlement constraint is

α 1 e−rt^1 + α 2 e−rt^2 + α 3 e−rt^3 = 1000e−rt.

The settlement constraint fixes one of the parameters. We thus need two more equations to fix all the parameters. We can use these degrees of freedom to set two derivatives to zero. (i.e., consider the time ∆t and an interest rate change ∆r. We will assume that ∆t → 0.) Setting the first and second derivatives to 0, we obtain two more equations:

α 1 t 1 e−rt^1 + α 2 t 2 e−rt^2 + α 3 t 3 e−rt^3 − 1000 te−rt^ = 0 , α 1 t^21 e−rt^1 + α 2 t^22 e−rt^2 + α 3 t^23 e−rt^3 − 1000 t^2 e−rt^ = 0.

Solving these three equations for the three unknowns αa, α 2 , α 3 gives

α 1 = Xe−r(t−t^1 )^

(t 2 − t)(t 3 − t) (t 2 − t 1 )(t 3 − t 1 )

α 2 = Xe−r(t−t^2 )^

(t 1 − t)(t 3 − t) (t 1 − t 2 )(t 3 − t 2 )

α 3 = Xe−r(t−t^3 )^

(t 1 − t)(t 2 − t) (t 1 − t 3 )(t 2 − t 3 )

Plugging in the values of t, t 1 , t 2 , t 3 , we obtain

α 1 = − 325. 1033 , α 2 = 987. 5778 , α 3 = 337. 5262.

(25 (35) points) Exponential Moving Average

(a) For t = 1,... , N,

MV (t) = (1 − e−λ)

∑^ t

i=−∞

e−λ(t−i)Si.

For t < 1, MV (t) = 0.

(b) Given MV (t + 1) = e−λMV (t) + (1 − e−λ)St+1, a straightforward linear time algorithm is obtained by sequentially updating MV (t + 1) from MV (t), starting with MV (0) = 0. The following sequence establishes this recurrence,

MV (t + 1) = (1 − e−λ)

∑^ t+

i=−∞

e−λ(t+1−i)Si,

= (1 − e−λ)

∑^ t i=−∞

e−λ(t+1−i)Si + (1 − e−λ)St+1,

= e−λ^ · (1 − e−λ)

∑^ t

i=−∞

e−λ(t−i)Si + (1 − e−λ)St+1,

= e−λ^ · MV (t) + (1 − e−λ)St+1.

(c)

0 0.5 1 1.5 2 2.5 3 3.5 4 4. x 10^5

0

20

40

60

80

100

120

140

(5 (15) points) Pattern Trading

Preprocess the database of patterns into a prefix tree, where each node stores the string ids of all its progeny leaf nodes (note that the prefix of any progeny leaf node is given by the path to node). This preprocessing is O(D). Now, to process the stock string, at every time, go backwards K characters, tracinig the path in the prefix tree. The all the progeny leafs of the node you end at are the K-active pattern strings. Since their ids are stored in the node, it is a simple matter to output the strings assuming that the database is indexed. The time to perform this entire operation at step t is O(Mt + K). Summing over t, we have O(M + NK).