Strategy return problem

Hi, when I was learning quant trading course, I find that the Jupyter code uses cumsum() to calculate the strategy return instead of using cumprod(). However, I think we should use cumprod() to find the cumulative return. May I know is there any justification for using cumsum()?



 

Hi BingMing,



If you would like to re-invest the return you captured from one period, then you can use cumprod(). However, if you would like to re-invest the same amount of money in every period no matter how much you make a profit or loss in the previous period (if you make a profit you take it and invest the remaining that is the initial amount, if you incur a loss you complete the shortage to reinvest the initial amount), then you can use cumsum().



The second point is that although you decide to reinvest the return from one period, if returns are log returns (if you use np.log() for calculating the returns), then cumsum() should be used. If they are normal returns (if you use pct_change() for calculating the returns), cumprod() should be used.



Hope this helps

Regards