and (code[:2] == '60' \ or code[:2] == '00' \ or code[:2] == '30'): if code[:2] == '60': stock_list.append("sh" + code) else: stock_list.append("sz" + code) from DataProviders.DailyFullMarket2D import DailyFullMarket2D as Provider from Models.ModelChange_AE import ModelChange as Model low, high, step, samples = -9.5, 9.5, 1, 3500 data_segment = 'today_full' result_cols = ['nextday_close'] provider = Provider(start_date, end_date, []) model = Model() cond = " `{0}` > {1} AND `{0}` < {2} ".format(result_cols[0], low, high) results = provider.fetch_resultset(result_cols, cond) results = provider.balance_result(result_cols[0], low, high, step, samples) results = results[result_cols].as_matrix() results = results[:, 0] data = provider.fetch_dataset(data_segment) # results = results * 0.1 # data = data[:10000] # results = results[:10000] count = data.shape[0]
exit(0) elif len(sys.argv) == 2: start_date = datetime.datetime.strptime(str(sys.argv[1]), "%Y-%m-%d").date() end_date = datetime.datetime.strptime(str(sys.argv[1]), "%Y-%m-%d").date() else: start_date = datetime.datetime.strptime(str(sys.argv[1]), "%Y-%m-%d").date() end_date = datetime.datetime.strptime(str(sys.argv[2]), "%Y-%m-%d").date() import numpy as np from DataProviders.DailyFullMarket2D import DailyFullMarket2D as Provider from Models.ModelCNN_NDC import Model_CNN_NDC as Model data_segment = 'today_full' result_cols = ['nextday_close'] provider = Provider(start_date, end_date) model = Model() results = provider.fetch_resultset(result_cols) data = provider.fetch_dataset(data_segment) real_results = results[result_cols] real_results = real_results.as_matrix()[:, 0] # data = data[:1000] # real_results = results[:1000] print(("Evaluating {} samples".format(data.shape[0]))) pred_results = model.predict(data) pred_results = pred_results.reshape(1, -1) results = pd.DataFrame(results)
"%Y-%m-%d").date() end_date = datetime.datetime.strptime(str(sys.argv[1]), "%Y-%m-%d").date() else: start_date = datetime.datetime.strptime(str(sys.argv[1]), "%Y-%m-%d").date() end_date = datetime.datetime.strptime(str(sys.argv[2]), "%Y-%m-%d").date() import numpy as np from DataProviders.DailyFullMarket2D import DailyFullMarket2D as Provider from Models.ModelCNN_NDC import Model_CNN_NDC as Model low, high, step, samples = -4, 4, 1, 2600 data_segment = 'today_full' result_cols = ['nextday_close'] provider = Provider(start_date, end_date) model = Model() results = provider.fetch_resultset(result_cols) results = provider.balance_result(result_cols[0], low, high, step, samples) results = results[result_cols].as_matrix() results = results[:, 0] data = provider.fetch_dataset(data_segment) # results = results * 0.1 # data = data[:10000] # results = results[:10000] count = data.shape[0] [training_data, training_result], \
elif len(sys.argv) == 2: start_date = datetime.datetime.strptime(str(sys.argv[1]), "%Y-%m-%d").date() end_date = datetime.datetime.strptime(str(sys.argv[1]), "%Y-%m-%d").date() else: start_date = datetime.datetime.strptime(str(sys.argv[1]), "%Y-%m-%d").date() end_date = datetime.datetime.strptime(str(sys.argv[2]), "%Y-%m-%d").date() from DataProviders.DailyFullMarket2D import DailyFullMarket2D as Provider low, high, step, samples = -9.5, 9.5, 1, 3500 data_segment = 'today_full' result_cols = ['nextday_close'] provider = Provider(start_date, end_date, []) cond = " `{0}` > {1} AND `{0}` < {2} ".format(result_cols[0], low, high) results = provider.fetch_resultset(result_cols, cond) results = provider.balance_result(result_cols[0], low, high, step, samples) results = results[result_cols].as_matrix() results = results[:, 0] input = provider.fetch_dataset(data_segment) # 先不缩放数据 只是观察 # psy_in = input[:, :, [68, 69]] # amp_in = input[:, :, [20]] #vr 22 vol 21 mdi_in = input[:, :, [57, 58, 59, 60]] input = mdi_in input = np.nan_to_num(input)
exit(0) elif len(sys.argv) == 2: start_date = datetime.datetime.strptime(str(sys.argv[1]), "%Y-%m-%d").date() end_date = datetime.datetime.strptime(str(sys.argv[1]), "%Y-%m-%d").date() else: start_date = datetime.datetime.strptime(str(sys.argv[1]), "%Y-%m-%d").date() end_date = datetime.datetime.strptime(str(sys.argv[2]), "%Y-%m-%d").date() from DataProviders.DailyFullMarket2D import DailyFullMarket2D as Provider data_segment = 'today_full' result_cols = ['nextday_close'] provider = Provider(start_date, end_date) results = provider.fetch_resultset(result_cols) low, high, step, samples = -7, 7, 1, 2600 # results = provider.balance_result(result_cols[0], low, high, step, samples) results = results[result_cols].as_matrix() results = results[:, 0] dist = np.arange(low, high + step, step) dist_count = [] results = pd.DataFrame(results) results.columns = ['value'] report = pd.DataFrame(columns=['range', 'count']) for i in range(len(dist) - 1): low = dist[i]