def read_results(): dir_path = path.REPORTS_DATA_DIR_PATH dir_path_list = glob.glob(os.path.join(dir_path, '*/')) results = [] for dir_path in dir_path_list: file_path = os.path.join(dir_path, path.RESULT_JSON_FILE) result = json.read(file_path) results.append(result) df = pd.DataFrame(results) df = df.set_index("start_timestamp") df.index.name = "timestamp" df = df.sort_values("timestamp") return df
def get_result_data(self, report_mode=False): if report_mode: config_file_path = os.path.join(path.REPORTS_DATA_DIR_PATH, self.timestamp, path.CONFIG_JSON_FILE) config = json.read(config_file_path) self.arbitrage.run(amount=int(config["amount"]), open_threshold=int(config["open_threshold"]), profit_margin_diff=int( config["profit_margin_diff"]), open_threshold_change_sec=int( config["open_threshold_change_sec"])) else: self.arbitrage.run() return self.arbitrage.get_result_data()
def __read_profit(self, keyword): file_name = "{}.json".format(keyword) file_path = os.path.join(self.dir_path, path.ASSETS_DIR, file_name) return json.read(file_path)
def __read_config(self): file_path = os.path.join(self.dir_path, path.CONFIG_JSON_FILE) return json.read(file_path)
def read_trading_end_asset(timestamp): file_path = __asset_file_path(timestamp, path.TRADING_END_ASSET_FILE) return json.read(file_path)
def read_trading_start_asset(timestamp): file_path = __asset_file_path(timestamp, path.TRADING_START_ASSET_FILE) return json.read(file_path)
def __read_asset(keyword): file_name = "{}.json".format(keyword) file_path = os.path.join(dir_path, path.ASSETS_DIR, file_name) return json.read(file_path)