In Neural Networks in Trading course, RNN-Example.ipynb , why is the timestep= 20 days used to create the input data?
Also what is code below doing?
timestep=20
X_list=
y_list=
for i in range(timestep,len(X)):
X_list.append(np.array(X.iloc[i-timestep:i]))
y_list.append(y.iloc[i])
Hi Kevin,
In the code, timestamp = 20 is used for the illustration purpose. You can optimise this parameter according to the data and train the model.
timestep=20
X_list=
y_list=
for i in range(timestep,len(X)):
X_list.append(np.array(X.iloc[i-timestep:i]))
y_list.append(y.iloc[i])
In this code, we will loop through timestamp (20) to the length of the variable X, which is the length of our original dataset.
Using the loop, we will feed the past 20-days of data at every time step to the RNN and predict next-day return based on that.
We have created empty lists X_list and y_list. In the x-list, we keep appending past 20 days of data and in the y_list, predicted 1-day future returns.