bug fixes
This commit is contained in:
parent
d7f257282c
commit
dd53e0a7af
@ -15,7 +15,7 @@ from datetime import datetime
|
||||
import subprocess
|
||||
import threading
|
||||
|
||||
from user_data.strategies.util import IS_BACKTEST, launcher, _perform_launcher
|
||||
from user_data.strategies.util import launcher, _perform_launcher
|
||||
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@ class Config:
|
||||
BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH = ""
|
||||
BACKTEST_YEAR = 2020
|
||||
BACKTEST_MONTH_INDEX = 9
|
||||
IS_BACKTEST = False
|
||||
IS_BACKTEST = True
|
||||
WORKSPACE_PATH = "workspace2" if IS_BACKTEST else "workspace"
|
||||
EXECUTION_PATH = "/root/" + WORKSPACE_PATH + "/execution/"
|
||||
IS_PARRALER_EXECUTION = True
|
||||
IS_PARRALER_EXECUTION = False
|
||||
|
@ -3,11 +3,10 @@ import datetime
|
||||
import time
|
||||
import os
|
||||
import sys
|
||||
from user_data.strategies.util import BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH, BACKTEST_YEAR, BACKTEST_MONTH_INDEX
|
||||
|
||||
from config import Config
|
||||
def clean_json():
|
||||
print("clean_json: json_path = " + BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH)
|
||||
file = open(BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH)
|
||||
print("clean_json: json_path = " + Config.BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH)
|
||||
file = open(Config.BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH)
|
||||
list = []
|
||||
data = json.load(file)
|
||||
for datas in data:
|
||||
@ -17,24 +16,24 @@ def clean_json():
|
||||
date = datetime.datetime.strptime(str(date), "%Y-%m-%d %H:%M:%S")
|
||||
year = date.year
|
||||
month = date.month
|
||||
if year == int(BACKTEST_YEAR) and month == int(BACKTEST_MONTH_INDEX):
|
||||
if year == int(Config.BACKTEST_YEAR) and month == int(Config.BACKTEST_MONTH_INDEX):
|
||||
list.append(datas)
|
||||
json_object = json.dumps(list)
|
||||
file.close()
|
||||
write_to_json(json_object)
|
||||
|
||||
def write_to_json(json_object):
|
||||
print("write_to_json: json_path = " + BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH)
|
||||
print("write_to_json: json_path = " + Config.BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH)
|
||||
with open("temp.json", "w") as outfile:
|
||||
outfile.write(json_object)
|
||||
os.rename("temp.json", BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH)
|
||||
os.rename("temp.json", Config.BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH)
|
||||
|
||||
if len(sys.argv) < 4:
|
||||
exit("""Incorrect number of arguments.
|
||||
python3 freq_data_cleaner.py [json_file] [month index] [year]
|
||||
""")
|
||||
else:
|
||||
BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH = sys.argv[1]
|
||||
BACKTEST_MONTH_INDEX = sys.argv[2]
|
||||
BACKTEST_YEAR = sys.argv[3]
|
||||
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()
|
@ -1,8 +1,8 @@
|
||||
import subprocess
|
||||
import threading
|
||||
from config import Config
|
||||
from user_data.strategies.config import Config
|
||||
|
||||
def launcher(mode, coin, brain,date_time):
|
||||
def launcher(mode, coin, brain,date_time = 12344315):
|
||||
if Config.IS_BACKTEST:
|
||||
if Config.IS_PARRALER_EXECUTION:
|
||||
threading.Thread(target=_perform_launcher, args=(mode, coin, brain)).start()
|
||||
|
Loading…
Reference in New Issue
Block a user