Created
November 13, 2019 09:34
-
-
Save joeng03/ea151ac1a2af439065f0cc7ddfc1938b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import pandas_datareader as pdr | |
from sklearn.preprocessing import MinMaxScaler | |
import matplotlib.pyplot as plt | |
TI= TechnicalIndicators() | |
close_data=TI.close_data[['4. close']] | |
macd_data=TI.macd_data | |
rsi_data=TI.rsi_data | |
bbands_data=TI.bbands_data | |
dataset = pd.concat([macd_data,rsi_data,bbands_data,close_data], axis=1,sort=True).reindex(macd_data.index) | |
dataset=dataset.drop(dataset.index[len(dataset)-1]) | |
close_data = dataset[['4. close']] | |
X=dataset.drop(dataset.index[len(dataset)-1]) | |
y=close_data.drop(close_data.index[0]) | |
values_x=X.values | |
values_y=y.values | |
scaler = MinMaxScaler(feature_range=(0, 1)) | |
scaled_data_X = scaler.fit_transform(values_x) | |
scaled_data_y = scaler.fit_transform(values_y) | |
X_train=scaled_data_X[:int(X.shape[0]*0.8)] | |
X_test= scaled_data_X[int(y.shape[0]*0.8):] | |
y_train=scaled_data_y[:int(X.shape[0]*0.8)] | |
y_test=scaled_data_y[int(y.shape[0]*0.8):] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment