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 | |
df = pd.read_csv('GS.csv') | |
df['Date'] = pd.to_datetime(df.Date) | |
df.index = df['Date'] | |
plt.figure(figsize=(16,8)) | |
plt.plot(df['Close']) |
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
from sklearn.preprocessing import MinMaxScaler | |
data = df.sort_index(ascending=True, axis=0) | |
new_data = pd.DataFrame(index=range(0,len(df)),columns=['Date', 'Close']) | |
for i in range(0,len(data)): | |
new_data['Date'][i] = data['Date'][i] | |
new_data['Close'][i] = data['Close'][i] | |
new_data.index = new_data.Date | |
new_data.drop('Date', axis=1, inplace=True) | |
dataset = new_data.values | |
scaler = MinMaxScaler(feature_range=(0, 1)) |
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
from keras.models import Sequential | |
from keras.layers import Dense, Dropout,LSTM | |
from keras.optimizers import Adam | |
model = Sequential() | |
model.add(LSTM(units=100,input_shape=(x_train.shape[1],1),return_sequences=True)) | |
model.add(LSTM(units=100)) | |
model.add(Dropout(0.4)) | |
model.add(Dense(1)) | |
ADAM = Adam(0.0005, beta_1=0.9, beta_2=0.999, amsgrad=False) | |
model.compile(loss='mean_squared_error', optimizer=ADAM) |
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 |
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 |
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
for i in range(65,y_train.shape[0]): | |
a_train.append(X_train[i-65:i-5,0]) | |
b_train.append(y_train[i-5:i,0]) | |
for x in range(65,y_test.shape[0]): | |
c_test.append(X_test[x-65:x-5,0]) | |
d_test.append(y_test[x-5:x,0]) |
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
function move_by_vector(element,direction,duration=1000) { | |
var elStyle = window.getComputedStyle(element); | |
var x_isNegated =(direction[0]<0)?true:false; | |
var y_isNegated =(direction[1]<0)?true:false; | |
var x_coord= elStyle.getPropertyValue('left').replace("px", ""); | |
var y_coord= elStyle.getPropertyValue('top').replace("px", ""); | |
var x_destination = Number(x_coord) + direction[0]; | |
var y_destination = Number(y_coord) + direction[1]; | |
var x_frameDistance = direction[0]/ (duration / 10); | |
var y_frameDistance = direction[1] / (duration / 10); |
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
function move(element,direction,duration=1000){ | |
var elStyle = window.getComputedStyle(element); | |
var x_coord= elStyle.getPropertyValue('left').replace("px", ""); | |
var y_coord= elStyle.getPropertyValue('top').replace("px", ""); | |
var x_frameDistance = direction[0]/ (duration / 10); | |
var y_frameDistance = direction[1] / (duration / 10); | |
function moveAFrame() { | |
elStyle = window.getComputedStyle(element); | |
x_coord = elStyle.getPropertyValue('left').replace("px",""); | |
var x_newLocation = Number(x_coord) + x_frameDistance; |
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 the required libraries | |
import requests | |
from datetime import timedelta,date | |
import numpy as np | |
from scipy.signal import argrelextrema | |
import matplotlib.pyplot as plt | |
import time |
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
data=requests.get('https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&outputsize=full&symbol=FB&apikey=YOURAPIKEY') | |
data=data.json() | |
prices_low,prices_high,prices_close=[],[],[] | |
for i in range(200,1,-1): | |
d=date.today()-timedelta(i) | |
d=d.strftime("%Y-%m-%d") | |
try: | |
prices_high.append(float(data["Time Series (Daily)"][d]["2. high"])) | |
prices_low.append(float(data["Time Series (Daily)"][d]["3. low"])) | |
prices_close.append(float(data["Time Series (Daily)"][d]["4. close"])) |
OlderNewer