import pandas as pd import plotly.offline as py import plotly.graph_objs as go from plotly import tools import data_loader from utils.indicators import addTendency from utils.plots import candlesPlot, closesPlot, movingAveragePlot, bollingerBandsPlots, volumePlot, tendencyShapes ticks = data_loader.getCandles('ETH-USD', 60, start='2016-10-14T00:00:25+01:00', end='2018-03-22T00:00:25+01:00', save=True) ticks = data_loader.getCandles('ETH-USD', 3600, save=False) addTendency(ticks, threshold=3) fig = tools.make_subplots(rows=2, cols=1) fig.append_trace(candlesPlot(ticks), 1, 1) fig.append_trace(closesPlot(ticks), 1, 1) fig.append_trace(movingAveragePlot(ticks, 10), 1, 1) (bbPlot1, bbPlot2) = bollingerBandsPlots(ticks, 10) fig.append_trace(bbPlot1, 1, 1) fig.append_trace(bbPlot2, 1, 1) fig.append_trace(volumePlot(ticks), 2, 1) fig['layout'].update(shapes=tendencyShapes(ticks))
action='store_true', default=False, help='use this to visualize the results of the currently trained model') args = parser.parse_args() use_cuda = torch.cuda.is_available() start_epoch = 0 # start from epoch 0 or last checkpoint epoch best_loss = 99999 ###Load data dataset = data_loader.getCandles('ETH-USD', 60, start='2018-03-12T13:19:54.527842', end='2018-03-15T13:19:54.527861', save=True) addTendency(dataset, threshold=0.05) scaler = StandardScaler() scaler.fit(dataset[['open', 'volume']]) t = scaler.transform(dataset[['open', 'volume']]) tdf = pd.DataFrame(t, columns=['open_norm', 'vol_norm'], index=dataset.index) dataset = pd.concat([dataset, tdf], axis=1) """###Split data into training and test. Training is the past, test is the future.""" # split into train and test sets train_size = int(len(dataset) * 0.7) test_size = len(dataset) - train_size train, test = dataset.iloc[0:train_size, :], dataset.iloc[ train_size:len(dataset), :] # print(len(train), len(test))
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../")) import pandas as pd import plotly.offline as py import plotly.graph_objs as go from plotly import tools import data_loader from utils.indicators import addTendency from utils.plots import candlesPlot, closesPlot, movingAveragePlot, bollingerBandsPlots, volumePlot, tendencyShapes ticks = data_loader.getCandles('ETH-USD', 60, start='2016-10-14T00:00:25+01:00', end='2018-03-22T00:00:25+01:00', save=True) ticks = data_loader.getCandles('ETH-USD', 3600, save=False) addTendency(dataset, threshold=3) fig = tools.make_subplots(rows=2, cols=1) fig.append_trace(candlesPlot(ticks), 1, 1) fig.append_trace(closesPlot(ticks), 1, 1) fig.append_trace(movingAveragePlot(ticks, 10), 1, 1) (bbPlot1, bbPlot2) = bollingerBandsPlots(ticks, 10) fig.append_trace(bbPlot1, 1, 1) fig.append_trace(bbPlot2, 1, 1) fig.append_trace(volumePlot(ticks), 2, 1) fig['layout'].update(shapes = tendencyShapes(ticks))
# -*- coding: utf-8 -*- import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../")) import pandas as pd import plotly.offline as py import plotly.graph_objs as go from plotly import tools import data_loader from utils.indicators import addTendency from utils.plots import candlesPlot, closesPlot, movingAveragePlot, bollingerBandsPlots, volumePlot, tendencyShapes ticks = data_loader.getCandles('ETH-USD', 60, start='2016-10-14T00:00:25+01:00', end='2018-03-22T00:00:25+01:00', save=True) #ticks = data_loader.getCandles('ETH-USD', 3600, save=False) addTendency(ticks, threshold=0.10) ticksSlice = ticks tenShapes = tendencyShapes(ticksSlice) layout = go.Layout( xaxis = dict( autorange=True ), yaxis = dict( autorange=True ), shapes = tenShapes ) data = [closesPlot(ticksSlice)]
help='Only visualize results of previously saved model') parser.add_argument('-r', '--resume', action='store_const', const=True, default=False, help='resume from previous checkpoint') args = parser.parse_args() """Get Data""" dataset = data_loader.getCandles('ETH-USD', 60, start='2018-02-01T00:00:25+01:00', end='2018-05-01T00:00:25+01:00', save=True) addTendency(dataset, threshold=0.10) scaler = StandardScaler() scaler.fit(dataset[['open', 'volume']]) t = scaler.transform(dataset[['open', 'volume']]) tdf = pd.DataFrame(t, columns=['open_norm', 'vol_norm'], index=dataset.index) dataset = pd.concat([dataset, tdf], axis=1) """###Split data into training and test. Training is the past, test is the future.""" # split into train and test sets train_size = int(len(dataset) * 0.7) test_size = len(dataset) - train_size train, test = dataset.iloc[0:train_size, :], dataset.iloc[ train_size:len(dataset), :] # print(len(train), len(test))
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../")) import pandas as pd import plotly.offline as py import plotly.graph_objs as go from plotly import tools import data_loader from utils.indicators import addTendency from utils.plots import candlesPlot, closesPlot, movingAveragePlot, bollingerBandsPlots, volumePlot, tendencyShapes #ticks = data_loader.getCandles('ETH-USD', 60, start='2016-10-14T00:00:25+01:00', end='2018-03-22T00:00:25+01:00', save=True) ticks = data_loader.getCandles('ETH-USD', 3600, save=False) addTendency(ticks, threshold=0.05) fig = tools.make_subplots(rows=2, cols=1) fig.append_trace(candlesPlot(ticks), 1, 1) fig.append_trace(closesPlot(ticks), 1, 1) fig.append_trace(movingAveragePlot(ticks, 10), 1, 1) (bbPlot1, bbPlot2) = bollingerBandsPlots(ticks, 10) fig.append_trace(bbPlot1, 1, 1) fig.append_trace(bbPlot2, 1, 1) fig.append_trace(volumePlot(ticks), 2, 1) fig['layout'].update(shapes = tendencyShapes(ticks))