Rachnog / Deep-Trading

Algorithmic trading with deep learning experiments
1.41k stars 696 forks source link

Slice indices issue in Simple time series forecasting.ipython #15

Open iamyin opened 6 years ago

iamyin commented 6 years ago

Hi Alex,

Thanks for sharing your code. I am new to Python and CNN. I found your post on Medium and would like to try out your code, logic, and approaches on my own Mac OS. I am able to follow through your code in "Neural networks for algorithmic trading. Part One Simple time series forecasting.ipython" up to the following error.


TypeErrorTraceback (most recent call last)

in () 6 X, Y = split_into_chunks(timeseries, TRAIN_SIZE, TARGET_TIME, LAG_SIZE, binary=False, scale=False) 7 X, Y = np.array(X), np.array(Y) ----> 8 X_train, X_test, Y_train, Y_test = create_Xt_Yt(X, Y, percentage=0.9) 9 10 Xp, Yp = split_into_chunks(timeseries, TRAIN_SIZE, TARGET_TIME, LAG_SIZE, binary=False, scale=False) in create_Xt_Yt(X, y, percentage) 85 print ("len(X):", len(X)) 86 print ("len(y):", len(y)) ---> 87 X_train = X[0:len(X) * percentage] 88 Y_train = y[0:len(y) * percentage] 89 TypeError: slice indices must be integers or None or have an __index__ method --------------------------------------------------------------------------------------------------- Can you please help to shed some lights on this issue? Thanks, Kiko