From 12fdc75745de60cbd4b6fd5f013059b7691ce393 Mon Sep 17 00:00:00 2001 From: Bemhreth Date: Sun, 23 Jan 2022 16:59:46 +0300 Subject: [PATCH] restructured --- .../freq_data_cleaner.py => freq_data_cleaner.py | 12 ++++++------ user_data/strategies/util.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) rename user_data/strategies/freq_data_cleaner.py => freq_data_cleaner.py (67%) diff --git a/user_data/strategies/freq_data_cleaner.py b/freq_data_cleaner.py similarity index 67% rename from user_data/strategies/freq_data_cleaner.py rename to freq_data_cleaner.py index f10605642..a8107fafe 100644 --- a/user_data/strategies/freq_data_cleaner.py +++ b/freq_data_cleaner.py @@ -3,11 +3,11 @@ import datetime import time import os import sys -from util import BACKTEST_JSON_PATH, BACKTEST_YEAR, BACKTEST_MONTH +from user_data.strategies.util import BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH, BACKTEST_YEAR, BACKTEST_MONTH def clean_json(): - print("clean_json: json_path = " + BACKTEST_JSON_PATH) - file = open(BACKTEST_JSON_PATH) + print("clean_json: json_path = " + BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH) + file = open(BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH) list = [] data = json.load(file) for datas in data: @@ -24,17 +24,17 @@ def clean_json(): write_to_json(json_object) def write_to_json(json_object): - print("write_to_json: json_path = " + BACKTEST_JSON_PATH) + print("write_to_json: json_path = " + BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH) with open("temp.json", "w") as outfile: outfile.write(json_object) - os.rename("temp.json", BACKTEST_JSON_PATH) + os.rename("temp.json", BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH) if len(sys.argv) < 4: exit("""Incorrect number of arguments. python3 freq_data_cleaner.py [json_file] [month] [year] """) else: - BACKTEST_JSON_PATH = sys.argv[1] + BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH = sys.argv[1] BACKTEST_MONTH = sys.argv[2] BACKTEST_YEAR = sys.argv[3] clean_json() \ No newline at end of file diff --git a/user_data/strategies/util.py b/user_data/strategies/util.py index 55b246ea3..52532a841 100644 --- a/user_data/strategies/util.py +++ b/user_data/strategies/util.py @@ -1,6 +1,6 @@ import subprocess -BACKTEST_JSON_PATH = "" +BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH = "" BACKTEST_YEAR = 2020 BACKTEST_MONTH = 10 IS_BACKTEST = False