plt.use("TkAgg") from matplotlib import pyplot as plt import json iter = 1 file_location = 'data/1.csv' startDate = {"year": 2013, "week": 1} instrument = 'EURUSD' data = ld.load(ld.Interval.HOURE, instrument, startDate, 54*4) candles = candle.Candles(data) candles.calc_gradients([2,3,4,5,6,7,8,9,10,20,40,80,100]) candles.calc_sma_seq([2,3,4,5,6,7,8,9,10]) candles.norm_by_column_sma() candles.norm_by_column_grad() candles.setGradToSimulation() env = FOREX(candles) dense_lstm_net = [ dict(type='dense', size=32), dict(type='internal_lstm', size=10) ] dense_net = [ dict(type='dense', size=32), dict(type='dense', size=64),
from tensorforce.execution import Runner from forex import FOREX import candle import numpy as np import FXCMDataLoader as ld import matplotlib as plt plt.use("TkAgg") from matplotlib import pyplot as plt import json startDate = {"year": 2018, "week": 1} instrument = 'EURUSD' traindata = ld.load(ld.Interval.HOURE, instrument, startDate, 50) candles = candle.Candles(traindata) candles.calc_sma([2, 3, 4, 5, 6, 7, 8, 9, 10]) candles.setSMAToSimulation() train_env = FOREX(candles) mid = candles.closeMid print("asdasdasd") print(mid[-1] / mid[0]) dense_lstm_net = [ dict(type='dense', size=32), dict(type='internal_lstm', size=64) ] dense_net = [
EU_USD.rename(index=str, columns={ "BidOpen": "Open", "BidHigh": "High", "BidLow": "Low", "BidClose": "Close" }, inplace=True) EU_USD.drop('AskOpen', axis=1, inplace=True) EU_USD.drop('AskClose', axis=1, inplace=True) EU_USD.drop('AskHigh', axis=1, inplace=True) EU_USD.drop('AskLow', axis=1, inplace=True) EU_USD.index = pd.to_datetime(EU_USD.index) candles = cn.Candles(raw_data) candles.calc_sma_seq([ 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 160, 180, 200, 220, 240, 280, 300 ]) candles.norm_by_column_sma() candles.setSMAToSimulation() env = FOREX(candles) dense_lstm_net = [ dict(type='dense', size=32), dict(type='internal_lstm', size=10) ] dense_net = [ dict(type='dense', size=32),
#data['HLDiff'].plot() file_location = 'data/1.csv' http_location = 'https://candledata.fxcorporate.com/D1/EURUSD/2017.csv.gz' #AUDCAD, AUDCHF, AUDJPY, AUDNZD, CADCHF, EURAUD, #EURCHF, EURGBP, EURJPY, EURUSD, GBPCHF, GBPJPY, #GBPNZD, GBPUSD, NZDCAD, NZDCHF, NZDJPY, NZDUSD, #USDCAD, USDCHF, USDJPY, AUDUSD, CADJPY, GBPCAD, #USDTRY, EURNZD startDate = {"year": 2012, "week": 1} instrument = 'EURUSD' data = ld.load(ld.Interval.HOURE, instrument, startDate, 54 * 7) candles = candle.Candles(data) data_brit = ld.load(ld.Interval.HOURE, 'EURGBP', startDate, 54 * 7) cand_brit = candle.Candles(data_brit) #candles.calc_gradients([50,100,150,200]) #candles.calc_sma_seq([10,30,50,70,90,110,130,150,170,190,210]) #candles.calc_sma([3,4,5,6]) #for i in list(range(2,14)): # result = gradient_linreg_slidewindow(closeAsk_y, window_size) # plt.plot(result['gradiens']) # window_size = window_size + 1 #plt.plot(closeAsk_y)