''' #---------GLOBAL SETTINGS------------------- path = 'D:\\BITBUCKET_PROJECTS\\Forecasting 1.0\\' STRATEGY = '3' DEVIATION = MULTIPLIER = 2 PERIOD = 20 DATA_LIMIT = 400 #--------RSI_SETTINGS------------------------ LOWER_BOUND = 30 UPPER_BOUND = 70 #--------MACD SETTINGS----------------------- FAST = 12 SLOW = 26 SIGNAL = 9 loc.set_path(path + 'DATASET') #-------get the data we need------------------ STOK_list = ls_STOK() Signal_Gen = {} for ii in range(DATA_LIMIT): print('{}'.format(STOK_list[ii])) data = loc.read_csv('{}'.format(STOK_list[ii]) + str('.csv')) data.index = pd.to_datetime(data.index) #-----convert to the stock class-------------- stock_data = stock(data) Fibo_SUP_RES_ = stock_data.fibonacci_pivot_point() df_RSI = RSI_signal(data, PERIOD, lw_bound=LOWER_BOUND, up_bound=UPPER_BOUND)
'days', #trading days 'months', #months 'DayOfTheWeek', #days of week 'time_epoch', #time epoch 'wday_sin', #sine of trading day 'wday_cos', #cosine of trading day 'mday_sin', #sine of days of the month 'mday_cos', #cosine of days of the month 'yday_sin', #sine of day of year 'yday_cos', #cosine of day of year 'month_sin', #sine of month 'month_cos' ] #cosine of month #set working directory loc.set_path('D:\\BITBUCKET_PROJECTS\\Forecasting 1.0\\DATASET') #stock list STOCK_list_ = ls_STOK() #window forecast = {} #//Extract Forecast window for pr in price: forecast_window, trad_days, dt_range = window(MIN_LAG, MAX_LAG, STEP, STOCK_name, pr, next_day) #train test X_train, X_test, Y_train, Y_test = Scale_train_test( forecast_window, trad_days) #yhat for all models Avg_price = Modeller(X_train, X_test, Y_train, Y_test, dt_range, params, EPOCHS)
from sklearn.preprocessing import StandardScaler from sklearn.pipeline import make_pipeline from sklearn.decomposition import PCA from sklearn.naive_bayes import GaussianNB from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor ''' Create date holder start date: indicates the last date in the series End date: indicates the numbers of days we want to project into ''' #set directory to fetch data loc.set_path('D:\\GIT PROJECT\\ERIC_PROJECT101\\FREELANCE_KENNETH\\DATASET') def predict_OHLC(NXT_DAY): ''' :Arguments: STOCKLIST: List of downloaded stock in the dataset folder NXTDAY: nextday to predict stock_data: stock class :Return: Next day Open, High, Low, Close for all stock ''' #get ojects in the dataset folder and