Implemented chages
This commit is contained in:
parent
151ab8bdc1
commit
a73d5cd7e3
@ -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/"
|
||||
|
@ -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()
|
Loading…
Reference in New Issue
Block a user