diff --git a/freqtrade/resolvers/strategy_resolver.py b/freqtrade/resolvers/strategy_resolver.py index 6e1e52cb7..71de94b1d 100644 --- a/freqtrade/resolvers/strategy_resolver.py +++ b/freqtrade/resolvers/strategy_resolver.py @@ -227,7 +227,16 @@ class StrategyResolver(IResolver): 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 + + if (type(strategy).populate_buy_trend == IStrategy.populate_buy_trend + and type(strategy).populate_entry_trend == IStrategy.populate_entry_trend): + raise OperationalException( + "`populate_entry_trend` or `populate_buy_trend` must be implemented.") + if (type(strategy).populate_sell_trend == IStrategy.populate_sell_trend + and type(strategy).populate_exit_trend == IStrategy.populate_exit_trend): + raise OperationalException( + "`populate_exit_trend` or `populate_sell_trend` must be 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) diff --git a/tests/strategy/test_strategy_loading.py b/tests/strategy/test_strategy_loading.py index 1de821146..97e915bb0 100644 --- a/tests/strategy/test_strategy_loading.py +++ b/tests/strategy/test_strategy_loading.py @@ -144,6 +144,16 @@ def test_strategy_can_short(caplog, default_conf): assert isinstance(strat, IStrategy) +def test_strategy_implements_populate_entry(caplog, default_conf): + caplog.set_level(logging.INFO) + default_conf.update({ + 'strategy': "StrategyTestV2", + }) + default_conf['trading_mode'] = 'futures' + with pytest.raises(OperationalException, match="`populate_entry_trend` must be implemented."): + StrategyResolver.load_strategy(default_conf) + + def test_strategy_override_minimal_roi(caplog, default_conf): caplog.set_level(logging.INFO) default_conf.update({