In [1]:
import pandas as pd
import chart_studio.plotly as py
import plotly.graph_objects as go
pd.options.plotting.backend = "plotly"
from sklearn.preprocessing import MinMaxScaler
import numpy as np
import torch
import torch.nn as nn
import plotly
from sklearn.metrics import mean_squared_error
import math
In [2]:
#references
#https://www.kaggle.com/taronzakaryan/stock-prediction-lstm-using-pytorch
#https://towardsdatascience.com/lstm-for-time-series-prediction-de8aeb26f2ca
#https://www.hardikp.com/2017/10/19/intraday-stock-price-prediction-2/
#https://stackabuse.com/time-series-prediction-using-lstm-with-pytorch-in-python/
#https://towardsdatascience.com/everything-you-need-to-know-about-min-max-normalization-in-python-b79592732b79
In [3]:
df = pd.read_parquet('data-3-year.parquet')
df.head()
Out[3]:
open high low close volume closetime assetvol numbertrades takerbasevol takerquotevol ignore
opentime
2017-08-20 15:15:00 4114.40000000 4114.40000000 4114.40000000 4114.40000000 1.40000000 1503242999999 5760.16000000 1 1.40000000 5760.16000000 9775.73635034
2017-08-20 15:30:00 4101.13000000 4101.13000000 4100.56000000 4101.13000000 5.79410000 1503243899999 23760.77285156 8 5.74107700 23543.31863557 9870.93950526
2017-08-20 15:45:00 4101.13000000 4125.00000000 4101.13000000 4125.00000000 15.03903300 1503244799999 61830.12235756 50 12.14217200 49925.68012013 9866.10295518
2017-08-20 16:00:00 4125.00000000 4128.11000000 4112.50000000 4128.11000000 6.32431800 1503245699999 26056.86112301 23 5.07519000 20904.12159282 9876.94656657
2017-08-20 16:15:00 4100.00000000 4111.51000000 4100.00000000 4111.51000000 0.60014800 1503246599999 2461.29910348 7 0.06014800 247.29910348 9872.63446931
In [4]:
df['close'].plot()