mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-01-19 21:40:24 +00:00
test: add test for adjust_order_price and adjust_entry_price collision
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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/"
|
||||
|
||||
Reference in New Issue
Block a user