Merge pull request #11 from tef-github/restructure_config

Implemented chages
This commit is contained in:
tef-github 2022-01-26 10:01:40 -05:00 committed by GitHub
commit 2a44bac754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -1,7 +1,7 @@
class Config:
BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH = ""
BACKTEST_YEAR = 2020
BACKTEST_MONTH_INDEX = 9
BACKTEST_DATA_CLEANER_YEAR = 2020
BACKTEST_DATA_CLEANER_MONTH_INDEX = 9
IS_BACKTEST = False
WORKSPACE_PATH = "workspace2" if IS_BACKTEST else "workspace"
EXECUTION_PATH = "/root/" + WORKSPACE_PATH + "/execution/"

View File

@ -4,6 +4,7 @@ import time
import os
import sys
from config import Config
def clean_json():
print("clean_json: json_path = " + Config.BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH)
file = open(Config.BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH)
@ -16,7 +17,7 @@ def clean_json():
date = datetime.datetime.strptime(str(date), "%Y-%m-%d %H:%M:%S")
year = date.year
month = date.month
if year == int(Config.BACKTEST_YEAR) and month == int(Config.BACKTEST_MONTH_INDEX):
if year == int(Config.BACKTEST_DATA_CLEANER_YEAR) and month == int(Config.BACKTEST_DATA_CLEANER_MONTH_INDEX):
list.append(datas)
json_object = json.dumps(list)
file.close()
@ -28,12 +29,10 @@ def write_to_json(json_object):
outfile.write(json_object)
os.rename("temp.json", Config.BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH)
if len(sys.argv) < 4:
if len(sys.argv) < 2:
exit("""Incorrect number of arguments.
python3 freq_data_cleaner.py [json_file] [month index] [year]
python3 freq_data_cleaner.py [json_file]
""")
else:
Config.BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH = sys.argv[1]
Config.BACKTEST_MONTH_INDEX = sys.argv[2]
Config.BACKTEST_YEAR = sys.argv[3]
clean_json()