May 2015
Beginner to intermediate
298 pages
5h 35m
English
We now have all the weekly returns based upon our strategy. We can calculate the overall net percentage return of the investments at the end by applying the cumulative product of 1 + base.ret0 (the return of each week) and then subtracting 1 from the cumulative product:
In [23]: base['cumret0'] = (1 + base.ret0).cumprod() - 1 base['cumret1'] = (1 + base.ret1).cumprod() - 1 base[['cumret0', 'cumret1']] Out[23]: cumret0 cumret1 GoogleWE 2004-01-10 0.00000 0.00000 2004-01-17 0.00000 0.00000 2004-01-24 0.00000 0.00000 2004-01-31 -0.00760 -0.00760 2004-02-07 0.00515 0.00515 ... ... ... 2011-01-29 2.70149 0.84652 2011-02-05 2.73394 0.86271 2011-02-12 2.71707 0.85430 2011-02-19 2.72118 ...
Read now
Unlock full access