Update buy_timeout and sell_timeout methods
This commit is contained in:
@@ -29,3 +29,21 @@ class TestStrategyImplementCustomSell(TestStrategyNoImplementSell):
|
||||
current_rate: float, current_profit: float,
|
||||
**kwargs):
|
||||
return False
|
||||
|
||||
|
||||
class TestStrategyImplementBuyTimeout(TestStrategyNoImplementSell):
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
return super().populate_exit_trend(dataframe, metadata)
|
||||
|
||||
def check_buy_timeout(self, pair: str, trade, order: dict,
|
||||
current_time: datetime, **kwargs) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
class TestStrategyImplementSellTimeout(TestStrategyNoImplementSell):
|
||||
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
return super().populate_exit_trend(dataframe, metadata)
|
||||
|
||||
def check_sell_timeout(self, pair: str, trade, order: dict,
|
||||
current_time: datetime, **kwargs) -> bool:
|
||||
return False
|
||||
|
@@ -418,11 +418,20 @@ def test_missing_implements(default_conf):
|
||||
StrategyResolver.load_strategy(default_conf)
|
||||
|
||||
default_conf['strategy'] = 'TestStrategyImplementCustomSell'
|
||||
|
||||
with pytest.raises(OperationalException,
|
||||
match=r"Please migrate your implementation of `custom_sell`.*"):
|
||||
StrategyResolver.load_strategy(default_conf)
|
||||
|
||||
default_conf['strategy'] = 'TestStrategyImplementBuyTimeout'
|
||||
with pytest.raises(OperationalException,
|
||||
match=r"Please migrate your implementation of `check_buy_timeout`.*"):
|
||||
StrategyResolver.load_strategy(default_conf)
|
||||
|
||||
default_conf['strategy'] = 'TestStrategyImplementSellTimeout'
|
||||
with pytest.raises(OperationalException,
|
||||
match=r"Please migrate your implementation of `check_sell_timeout`.*"):
|
||||
StrategyResolver.load_strategy(default_conf)
|
||||
|
||||
|
||||
@pytest.mark.filterwarnings("ignore:deprecated")
|
||||
def test_call_deprecated_function(result, default_conf, caplog):
|
||||
|
Reference in New Issue
Block a user