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