fix pr comments

This commit is contained in:
tef 2022-01-15 00:35:18 -05:00
parent 40bc3c6319
commit 9e44990ae7
4 changed files with 33 additions and 8 deletions

View File

@ -15,6 +15,7 @@ from datetime import datetime
import subprocess import subprocess
import threading import threading
from user_data.strategies.util import thread_executor, IS_BACKTEST, launcher, back_tester
class Strategy002(IStrategy): class Strategy002(IStrategy):
@ -140,10 +141,6 @@ class Strategy002(IStrategy):
), ),
'sell'] = 1 'sell'] = 1
return dataframe return dataframe
def call_launcher(self, mode, coin):
print("strategy002: call_launcher: mode = " + mode + " coin = " +coin)
subprocess.call("python3 /root/workspace2/execution/launcher.py " + mode + " " + coin, shell=True)
def confirm_trade_entry(self, pair: str, order_type: str, amount: float, rate: float, def confirm_trade_entry(self, pair: str, order_type: str, amount: float, rate: float,
time_in_force: str, current_time: datetime, **kwargs) -> bool: time_in_force: str, current_time: datetime, **kwargs) -> bool:
@ -168,7 +165,9 @@ class Strategy002(IStrategy):
""" """
mode = "test" mode = "test"
coin = pair.split("/")[0] coin = pair.split("/")[0]
thread = threading.Thread(target=self.call_launcher, args=(mode,coin)) if IS_BACKTEST:
thread.start() 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)