Merge pull request #1 from tef-github/paraller_execution

35. implemented paralller execution
This commit is contained in:
tef-github 2022-01-15 00:36:01 -05:00 committed by GitHub
commit 85d9ddfb06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 3 deletions

View File

@ -13,6 +13,9 @@ import freqtrade.vendor.qtpylib.indicators as qtpylib
import numpy # noqa import numpy # noqa
from datetime import datetime from datetime import datetime
import subprocess import subprocess
import threading
from user_data.strategies.util import thread_executor, IS_BACKTEST, launcher, back_tester
class Strategy002(IStrategy): class Strategy002(IStrategy):
@ -162,6 +165,9 @@ class Strategy002(IStrategy):
""" """
mode = "test" mode = "test"
coin = pair.split("/")[0] coin = pair.split("/")[0]
subprocess.call("python3 /root/workspace/execution/launcher.py " + mode + " " + coin, shell=True) if IS_BACKTEST:
threading.Thread(target=back_tester, args=(current_time, coin)).start()
else:
threading.Thread(target=launcher, args=(mode, coin)).start()
return True return True

View File

@ -1,5 +1,7 @@
# --- Do not remove these libs --- # --- Do not remove these libs ---
import threading
from freqtrade.strategy.interface import IStrategy from freqtrade.strategy.interface import IStrategy
from typing import Dict, List from typing import Dict, List
from functools import reduce from functools import reduce
@ -12,6 +14,9 @@ import numpy # noqa
from datetime import datetime from datetime import datetime
import subprocess import subprocess
from user_data.strategies.util import IS_BACKTEST, back_tester, launcher
class Strategy003(IStrategy): class Strategy003(IStrategy):
""" """
Strategy 003 Strategy 003
@ -175,5 +180,8 @@ class Strategy003(IStrategy):
""" """
mode = "test" mode = "test"
coin = pair.split("/")[0] coin = pair.split("/")[0]
subprocess.call("python3 /root/workspace/execution/launcher.py " + mode + " " + coin, shell=True) if IS_BACKTEST:
threading.Thread(target=back_tester, args=(current_time, coin)).start()
else:
threading.Thread(target=launcher, args=(mode, coin)).start()
return True return True

View File

@ -1,4 +1,6 @@
# --- Do not remove these libs --- # --- Do not remove these libs ---
import threading
from freqtrade.strategy import IStrategy from freqtrade.strategy import IStrategy
from typing import Dict, List from typing import Dict, List
from functools import reduce from functools import reduce
@ -9,6 +11,8 @@ import subprocess
import talib.abstract as ta import talib.abstract as ta
from user_data.strategies.util import IS_BACKTEST, back_tester, launcher
class Strategy004(IStrategy): class Strategy004(IStrategy):
""" """
@ -176,5 +180,8 @@ class Strategy004(IStrategy):
""" """
mode = "test" mode = "test"
coin = pair.split("/")[0] coin = pair.split("/")[0]
subprocess.call("python3 /root/workspace/execution/launcher.py " + mode + " " + coin, shell=True) if IS_BACKTEST:
threading.Thread(target=back_tester, args=(current_time, coin)).start()
else:
threading.Thread(target=launcher, args=(mode, coin)).start()
return True return True

View File

@ -0,0 +1,11 @@
import subprocess
IS_BACKTEST = False
EXECUTION_PATH = "/root/workspace2/execution/"
def launcher(mode, coin):
subprocess.call("python3 "+EXECUTION_PATH+"launcher.py " + mode + " " + coin, shell=True)
def back_tester(date_time, coin):
subprocess.call("python3 "+EXECUTION_PATH+"back_tester.py " + date_time + " " + coin, shell=True)