diff --git a/tests/strategy/strats/broken_strats/broken_futures_strategies.py b/tests/strategy/strats/broken_strats/broken_futures_strategies.py index b2131e63e..a3e51bc50 100644 --- a/tests/strategy/strats/broken_strats/broken_futures_strategies.py +++ b/tests/strategy/strats/broken_strats/broken_futures_strategies.py @@ -21,10 +21,12 @@ class TestStrategyNoImplementSell(TestStrategyNoImplements): return super().populate_entry_trend(dataframe, metadata) -class TestStrategyImplementCustomSell(TestStrategyNoImplementSell): +class TestStrategyImplementEmptyWorking(TestStrategyNoImplementSell): def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: return super().populate_exit_trend(dataframe, metadata) + +class TestStrategyImplementCustomSell(TestStrategyImplementEmptyWorking): def custom_sell( self, pair: str, @@ -55,3 +57,34 @@ class TestStrategyImplementSellTimeout(TestStrategyNoImplementSell): self, pair: str, trade, order: Order, current_time: datetime, **kwargs ) -> bool: return False + + +class TestStrategyAdjustOrderPrice(TestStrategyImplementEmptyWorking): + def adjust_entry_price( + self, + trade, + order, + pair, + current_time, + proposed_rate, + current_order_rate, + entry_tag, + side, + **kwargs, + ): + return proposed_rate + + def adjust_order_price( + self, + trade, + order, + pair, + current_time, + proposed_rate, + current_order_rate, + entry_tag, + side, + is_entry, + **kwargs, + ): + return proposed_rate diff --git a/tests/strategy/test_strategy_loading.py b/tests/strategy/test_strategy_loading.py index 9b143ace6..927f33461 100644 --- a/tests/strategy/test_strategy_loading.py +++ b/tests/strategy/test_strategy_loading.py @@ -460,6 +460,10 @@ def test_missing_implements(default_conf, caplog): ): StrategyResolver.load_strategy(default_conf) + default_conf["strategy"] = "TestStrategyAdjustOrderPrice" + with pytest.raises(OperationalException, match=r"If you implement `adjust_order_price`.*"): + StrategyResolver.load_strategy(default_conf) + def test_call_deprecated_function(default_conf): default_location = Path(__file__).parent / "strats/broken_strats/"