Error calculating strategy returns GARCH model

Course Name: Financial Time Series Analysis for Trading, Section No: 25, Unit No: 9, Unit type: Notebook

Hello, as we did in previously units, here we should calculate the strategy returns using only those rows where I've predictions as I'm generating signals using a rolling window of 252 days, so here we must use:

data["VXX"].pct_change()[252:] * data.signal.shift(1)

https://i.imgur.com/fu2CXYa.png

Hi Daniel, 



The reason why we were only considering the rows after the rolling window was because the rows prior to this would have NaN values. For example, if the rolling window is 252 then the first 252 rows of the data would have NaN values. 



The objective is to not include any rows with NaN values which can either be done by taking only the rows that come after the rolling window, or in the case of this notebook, we have dropped the rows with NaN values using dropna. Either way would be right since both achieve the desired objective.



If you print data you will see that it does not have NaN values:





Hope this helps!



Thanks

Rushda

Got it, thanks!