Docsity

Assignment 3 Solutions for Data Science | CSCI 6961, Assignments of Computer Science

Toggle sidebar
bg1
CSCI 6961 RPI
Introduction to Computational Finance Fall 2008
ASSIGNMENT 3 Solutions
Homeworks are due at the begining of class or in my mail box by 2pm on the due date. The point
value for the 6000 level is indicated in small font.
1 (100 (50) points) Trading Systems
(a) [40 (20)]The only complicated thing to compute is the MDD. The observation is that the
maximum drop ending at time tis the previous maximum minus the current value. A pseudo-
code is
Set cumret=0;ret2=0;curDD=0;MDD=0;prevmax=0;
for i=1:N do
cumret=cumret+r(i);
ret2=ret2+(r(i)*r(i)-ret2)/i;
if prevmax<cumret then
prevmax=cumret;
end if
curDD=prevmax-cumret;
if curDD>MDD then
MDD=curDD;
end if
end for
totret=cumret;
µ=cumret/length(r);
σ=pret2 −µ2;
(b) (i) [10 (5)]
Instrument Total Return µSharpe Sterling
bond 0.23699 2.7448e-06 2.0294e+07 ∞
DELL 2.344 2.7148e-05 1.6878 2.1159
IBM 1.4646 1.6963e-05 1.5924 3.0855
After adjusting for the risk free rate:
Instrument Total Return µSharpe Sterling
bond 0 0 0 0
DELL 2.107 2.4405e-05 1.5171 1.8348
IBM 1.2276 1.4219e-05 1.3347 2.499
Assume that the risk free rate is a constant. Then µwill drop, σwill be unchanged, and
MDD will rise.
1
pf3

Partial preview of the text

Download Assignment 3 Solutions for Data Science | CSCI 6961 and more Assignments Computer Science in PDF only on Docsity!

CSCI 6961 RPI

Introduction to Computational Finance Fall 2008

ASSIGNMENT 3 Solutions

Homeworks are due at the begining of class or in my mail box by 2pm on the due date. The point value for the 6000 level is indicated in small font.

1 (100 (50) points) Trading Systems

(a) [ 40 (20)] The only complicated thing to compute is the MDD. The observation is that the

maximum drop ending at time t is the previous maximum minus the current value. A pseudo- code is Set cumret=0;ret2=0;curDD=0;MDD=0;prevmax=0; for i=1:N do cumret=cumret+r(i); ret2=ret2+(r(i)*r(i)-ret2)/i; if prevmaxMDD then MDD=curDD; end if end for totret=cumret; μ=cumret/length(r); σ =

√ ret2 − μ^2 ;

(b) (i) [ 10 (5)]

Instrument Total Return μ Sharpe Sterling bond 0.23699 2.7448e-06 2.0294e+07 ∞ DELL 2.344 2.7148e-05 1.6878 2. IBM 1.4646 1.6963e-05 1.5924 3. After adjusting for the risk free rate: Instrument Total Return μ Sharpe Sterling bond 0 0 0 0 DELL 2.107 2.4405e-05 1.5171 1. IBM 1.2276 1.4219e-05 1.3347 2. Assume that the risk free rate is a constant. Then μ will drop, σ will be unchanged, and MDD will rise.

(ii) [ 10 (5)] Statistics for a random strategy on bond, IBM.

Spread Fraction Total Return μ Sharpe Sterling 0 0.6251 7.24e-06 0.96317 1. 0.0001 -4.0005 -4.6334e-05 -6.1549 -0. 0.0002 -8.6255 -9.9902e-05 -13.256 -0. 0.0005 -22.497 -0.00026057 -34.289 -0. Buy and hold strategies are much better than the random strategy.

(c) [ 40 (20)]

To make sure that the algorithm that computes the optimal strategy is linear time, you need keep a backtracking vector of the best state to come from to end in state 1,0. Then using this backtracking vector, you can extract the optimal trading strategy by determining first what the best state to be in at the end is, then going backward.

Pair Total Return μ Sharpe Sterling Bond-IBM 7.4833 8.6673e-05 9.79 125. Bond-DELL 16.776 0.0001943 14.938 135. IBM-DELL 15.102 0.00017491 11.979 68.

−1 (^0 1 2 3 4 5 6 7 8) x 10 49

0

1

2

3

4

5

6

7

8 PL for BOND and IBM, with spread frac=0.

−2 (^0 1 2 3 4 5 6 7 8) x 10 49

0

2

4

6

8

10

12

14

16

18 PL for BOND and DELL, with spread frac=0.

−2 (^0 1 2 3 4 5 6 7 8) x 10 49

0

2

4

6

8

10

12

14

16 PL for IBM and DELL, with spread frac=0.

Bond-IBM Bond-DELL IBM-DELL

Notice that Bond-Dell does better than IBM-DELL, even though IBM does better than Bond. This is because the two stocks are highly correlated, so when DELL goes down, so does IBM. The advantage of having another stock is that when one goes down, the other can be moved into if it is rising, which cannot happen if they are both going down. Thus the optimal strategy will be better if you have two good stocks that are uncorrelated.

2 (10 (50) points) Optimal Trade Entry/Exit

(a) The number of ways to sell K shares in T time steps is

( T +K− 1 K

) , which in this case is 92378.