from oandapyV20.exceptions import V20Error import oandapyV20.endpoints.accounts as accounts import oandapyV20.endpoints.instruments as instruments import oandapyV20.endpoints.orders as orders import oandapyV20.endpoints.positions as positions import oandapyV20.endpoints.trades as trades # import telebot # Bot Parameters spread_limit = 3.5 Multi_Threading = True Tgr_Verbose = True # Load Settings config_path = 'CONFIG\config_trading.yml' config_trading = FileIO.read_yaml(config_path) instrument_1 = config_trading['Instrument_A'] instrument_2 = config_trading['Instrument_B'] # OANDA Config accountID = config_trading['DataOandaAccount'] access_token = config_trading['DataOandaToken'] # Telegram Config TOKEN = config_trading['DataTgrChatID'] chatid = config_trading['DataTgrToken'] # tb = telebot.TeleBot(TOKEN) # Do Not Touch pairs_traded = '%s,%s' % (str(instrument_1), str(instrument_2)) pairs_traded_dict = {instrument_1, instrument_2}
import pandas as pd import numpy as np import MAIN.Basics as basics import MAIN.Reinforcement as RL import tensorflow as tf import seaborn as sns import matplotlib.pyplot as plt from UTIL import FileIO from STRATEGY.Cointegration import EGCointegration # Read config config_path = 'CONFIG\config_train.yml' config_train = FileIO.read_yaml(config_path) # Read prices x = pd.read_csv('STATICS\PRICE\JNJ.csv') y = pd.read_csv('STATICS\PRICE\PG.csv') x, y = EGCointegration.clean_data(x, y, 'date', 'close') # Separate training and testing sets train_pct = 0.7 train_len = round(len(x) * 0.7) idx_train = list(range(0, train_len)) idx_test = list(range(train_len, len(x))) EG_Train = EGCointegration(x.iloc[idx_train, :], y.iloc[idx_train, :], 'date', 'close') EG_Test = EGCointegration(x.iloc[idx_test, :], y.iloc[idx_test, :], 'date', 'close') # Create action space n_hist = list(np.arange(60, 601, 60)) n_forward = list(np.arange(120, 1201, 120))
import time import sys sys.path.insert(0, r'C:\DATA\Projects\PortFolioProjects\ThirdProject\Code') from UTIL import FileIO from DATA import API config_path = 'CONFIG\config_data.yml' config = FileIO.read_yaml(config_path) attr = ['date', 'close'] # https://dailypik.com/top-50-companies-sp-500/ #ticker_list = ['MSFT', 'AAPL', 'AMZN', 'GOOGL', 'FB', 'GOOG'] #ticker_list = ['NVDA', 'CRM', 'PYPL', 'NFLX', 'ABT', 'TMO', 'ABBV', 'COST'] # ticker_list = ['QCOM', 'NKE', 'MCD', 'ACN', 'MDT', 'AVGO', 'NEE', 'DHR', 'BMY', 'TXN', 'HON', 'AMGN', 'LIN'] #ticker_list = ['BRK-B', 'V', 'JPM', 'JNJ', 'WMT'] #ticker_list = ['MA', 'PG', 'BAC', 'INTC', 'T'] #ticker_list = ['UNH', 'XOM', 'HD', 'DIS','KO'] #ticker_list = ['VZ', 'MRK', 'PFE', 'CVX', 'CSCO'] #ticker_list = ['CMCSA', 'PEP', 'WFC', 'BA', 'ADBE'] import pickle def load_dic(name): with open(r'DATA/' + name + '.pkl', 'rb') as f: return pickle.load(f) sec_sym_dic = load_dic('sec_sym_dic') #curr_sector = 'Information Technology'