Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Instability of Parameter Estimates Excercise 3

Hi,

I do not understand why adding 10 when slicing the returns and the treasury_ret.

running_sharpe = [sharpe_ratio(returns[i-window+10:i], treasury_ret[i-window+10:i]) for i in range(window-10, len(returns))]

because this reduces rolling period (50 -> 40, 150 -> 140 and 300 -> 290).

and I used rolling.apply function as below, but I got different result.

alfa = returns - treasury_ret
running_sharpe = alfa.rolling(40).apply(lambda x: np.mean(x)/np.std(x)) # window = 50

Could anyone help me with this?

tks.