diff --git a/freqtrade/configuration/deprecated_settings.py b/freqtrade/configuration/deprecated_settings.py index c8b3c08d6..1b162f7c9 100644 --- a/freqtrade/configuration/deprecated_settings.py +++ b/freqtrade/configuration/deprecated_settings.py @@ -3,7 +3,7 @@ Functions to handle deprecated settings """ import logging -from typing import Any, Dict +from typing import Any, Dict, Optional from freqtrade.exceptions import OperationalException @@ -13,7 +13,7 @@ logger = logging.getLogger(__name__) def check_conflicting_settings(config: Dict[str, Any], section_old: str, name_old: str, - section_new: str, name_new: str) -> None: + section_new: Optional[str], name_new: str) -> None: section_new_config = config.get(section_new, {}) if section_new else config section_old_config = config.get(section_old, {}) if name_new in section_new_config and name_old in section_old_config: @@ -29,7 +29,7 @@ def check_conflicting_settings(config: Dict[str, Any], def process_removed_setting(config: Dict[str, Any], section1: str, name1: str, - section2: str, name2: str) -> None: + section2: Optional[str], name2: str) -> None: """ :param section1: Removed section :param name1: Removed setting name @@ -48,7 +48,7 @@ def process_removed_setting(config: Dict[str, Any], def process_deprecated_setting(config: Dict[str, Any], section_old: str, name_old: str, - section_new: str, name_new: str + section_new: Optional[str], name_new: str ) -> None: check_conflicting_settings(config, section_old, name_old, section_new, name_new) section_old_config = config.get(section_old, {}) diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 6cacd150b..7aa7e57d9 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -97,6 +97,11 @@ class IStrategy(ABC, HyperStrategyMixin): # run "populate_indicators" only for new candle process_only_new_candles: bool = False + use_sell_signal: bool + sell_profit_only: bool + sell_profit_offset: float + ignore_roi_if_buy_signal: bool + # Number of seconds after which the candle will no longer result in a buy on expired candles ignore_buying_expired_candle_after: int = 0 diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 9d3ec5fea..8edd09c5a 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -1128,10 +1128,17 @@ def test_pairlist_resolving_fallback(mocker): assert config['datadir'] == Path.cwd() / "user_data/data/binance" -# The below is kept as a sample for the future. @pytest.mark.parametrize("setting", [ ("ask_strategy", "use_sell_signal", True, None, "use_sell_signal", False), + ("ask_strategy", "sell_profit_only", True, + None, "sell_profit_only", False), + ("ask_strategy", "sell_profit_offset", 0.1, + None, "sell_profit_offset", 0.01), + ("ask_strategy", "ignore_roi_if_buy_signal", True, + None, "ignore_roi_if_buy_signal", False), + ("ask_strategy", "ignore_buying_expired_candle_after", 5, + None, "ignore_buying_expired_candle_after", 6), ]) def test_process_temporary_deprecated_settings(mocker, default_conf, setting, caplog): patched_configuration_load_config_file(mocker, default_conf) @@ -1171,7 +1178,6 @@ def test_process_temporary_deprecated_settings(mocker, default_conf, setting, ca assert default_conf[setting[4]] == setting[2] - @pytest.mark.parametrize("setting", [ ("experimental", "use_sell_signal", False), ("experimental", "sell_profit_only", True),