diff --git a/user_data/strategies/Strategy002.py b/user_data/strategies/Strategy002.py index 8684520b6..ff63d7237 100644 --- a/user_data/strategies/Strategy002.py +++ b/user_data/strategies/Strategy002.py @@ -15,7 +15,7 @@ from datetime import datetime import subprocess import threading -from user_data.strategies.util import IS_BACKTEST, launcher, back_tester +from user_data.strategies.util import IS_BACKTEST, launcher, _perform_launcher @@ -168,10 +168,8 @@ class Strategy002(IStrategy): mode = "test" coin = pair.split("/")[0] brain = "Freq_" + self.__class__.__name__ - if IS_BACKTEST: - threading.Thread(target=back_tester, args=(current_time, coin, brain)).start() - else: - threading.Thread(target=launcher, args=(mode, coin, brain)).start() + launcher(mode, current_time, coin, brain) + return True diff --git a/user_data/strategies/config.py b/user_data/strategies/config.py new file mode 100644 index 000000000..a4c97831e --- /dev/null +++ b/user_data/strategies/config.py @@ -0,0 +1,8 @@ +class Config: + BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH = "" + BACKTEST_YEAR = 2020 + BACKTEST_MONTH_INDEX = 9 + IS_BACKTEST = False + WORKSPACE_PATH = "workspace2" if IS_BACKTEST else "workspace" + EXECUTION_PATH = "/root/" + WORKSPACE_PATH + "/execution/" + IS_PARRALER_EXECUTION = True diff --git a/freq_data_cleaner.py b/user_data/strategies/freq_data_cleaner.py similarity index 100% rename from freq_data_cleaner.py rename to user_data/strategies/freq_data_cleaner.py diff --git a/user_data/strategies/util.py b/user_data/strategies/util.py index 3bc589490..6956eb72d 100644 --- a/user_data/strategies/util.py +++ b/user_data/strategies/util.py @@ -1,21 +1,25 @@ import subprocess import threading +from config import Config -BACKTEST_DOWNLOADED_JSON_DATA_FILE_PATH = "" -BACKTEST_YEAR = 2020 -BACKTEST_MONTH_INDEX = 9 -IS_BACKTEST = False -WORKSPACE_PATH = "workspace2" if IS_BACKTEST else "workspace" -EXECUTION_PATH = "/root/" + WORKSPACE_PATH + "/execution/" - - -def launcher(mode, coin, brain): - threading.Thread(target=_perform_launcher, args=(mode, coin, brain)).start() +def launcher(mode, coin, brain,date_time): + if Config.IS_BACKTEST: + if Config.IS_PARRALER_EXECUTION: + threading.Thread(target=_perform_launcher, args=(mode, coin, brain)).start() + else: + date = str(date_time) + date = date.replace(" ", "#") + subprocess.call("python3 "+ Config.EXECUTION_PATH + "back_tester.py " + date + " " + coin + " " + brain + " 0.45 3", shell=True) + else: + if Config.IS_PARRALER_EXECUTION: + threading.Thread(target=_perform_launcher, args=(mode, coin, brain)).start() + else: + subprocess.call("python3 "+Config.EXECUTION_PATH+"launcher.py " + mode + " " + coin + " " + brain, shell=True) def _perform_launcher(mode, coin, brain): - subprocess.call("python3 "+EXECUTION_PATH+"launcher.py " + mode + " " + coin + " " + brain, shell=True) + subprocess.call("python3 "+Config.EXECUTION_PATH+"launcher.py " + mode + " " + coin + " " + brain, shell=True) def back_tester(date_time, coin, brain): date = str(date_time) date = date.replace(" ", "#") - subprocess.call("python3 "+ EXECUTION_PATH + "back_tester.py " + date + " " + coin + " " + brain + " 0.45 3", shell=True) + subprocess.call("python3 "+ Config.EXECUTION_PATH + "back_tester.py " + date + " " + coin + " " + brain + " 0.45 3", shell=True)