Change populate_buy_trend to populate_entry_trend

This commit is contained in:
Matthias
2022-03-12 09:31:14 +01:00
parent efc313b28b
commit 28046c6a22
7 changed files with 64 additions and 39 deletions

View File

@@ -220,15 +220,23 @@ class StrategyResolver(IResolver):
)
if strategy:
strategy._populate_fun_len = len(getfullargspec(strategy.populate_indicators).args)
strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args)
strategy._sell_fun_len = len(getfullargspec(strategy.populate_sell_trend).args)
if any(x == 2 for x in [
strategy._populate_fun_len,
strategy._buy_fun_len,
strategy._sell_fun_len
]):
strategy.INTERFACE_VERSION = 1
if strategy.config.get('trading_mode', TradingMode.SPOT) != TradingMode.SPOT:
# Require new method
if type(strategy).populate_entry_trend == IStrategy.populate_entry_trend:
raise OperationalException("`populate_entry_trend` must be implemented.")
if type(strategy).populate_exit_trend == IStrategy.populate_exit_trend:
raise OperationalException("`populate_exit_trend` must be implemented.")
else:
# TODO: Verify if populate_buy and populate_sell are implemented
strategy._populate_fun_len = len(getfullargspec(strategy.populate_indicators).args)
strategy._buy_fun_len = len(getfullargspec(strategy.populate_buy_trend).args)
strategy._sell_fun_len = len(getfullargspec(strategy.populate_sell_trend).args)
if any(x == 2 for x in [
strategy._populate_fun_len,
strategy._buy_fun_len,
strategy._sell_fun_len
]):
strategy.INTERFACE_VERSION = 1
return strategy