diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index d91a33926..fd9c83d51 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -389,13 +389,6 @@ class Exchange: f'On exchange stoploss is not supported for {self.name}.' ) - # Limit price threshold: As limit price should always be below stop-price - # Used for limit stoplosses on exchange - limit_price_pct = order_types.get('stoploss_on_exchange_limit_ratio', 0.99) - if limit_price_pct >= 1.0 or limit_price_pct <= 0.0: - raise OperationalException( - "stoploss_on_exchange_limit_ratio should be < 1.0 and > 0.0") - def validate_order_time_in_force(self, order_time_in_force: Dict) -> None: """ Checks if order time in force configured in strategy/config are supported diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index 1101f3e74..60c4847f6 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -746,28 +746,6 @@ def test_validate_order_types(default_conf, mocker): match=r'On exchange stoploss is not supported for .*'): Exchange(default_conf) - default_conf['order_types'] = { - 'buy': 'limit', - 'sell': 'limit', - 'stoploss': 'limit', - 'stoploss_on_exchange': False, - 'stoploss_on_exchange_limit_ratio': 1.05 - } - with pytest.raises(OperationalException, - match=r'stoploss_on_exchange_limit_ratio should be < 1.0 and > 0.0'): - Exchange(default_conf) - - default_conf['order_types'] = { - 'buy': 'limit', - 'sell': 'limit', - 'stoploss': 'limit', - 'stoploss_on_exchange': False, - 'stoploss_on_exchange_limit_ratio': -0.1 - } - with pytest.raises(OperationalException, - match=r'stoploss_on_exchange_limit_ratio should be < 1.0 and > 0.0'): - Exchange(default_conf) - def test_validate_order_types_not_in_config(default_conf, mocker): api_mock = MagicMock() diff --git a/tests/test_configuration.py b/tests/test_configuration.py index cccc87670..ca5d6eadc 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -871,6 +871,14 @@ def test_load_config_default_exchange_name(all_conf) -> None: validate_config_schema(all_conf) +def test_load_config_stoploss_exchange_limit_ratio(all_conf) -> None: + all_conf['order_types']['stoploss_on_exchange_limit_ratio'] = 1.15 + + with pytest.raises(ValidationError, + match=r"1.15 is greater than the maximum"): + validate_config_schema(all_conf) + + @pytest.mark.parametrize("keys", [("exchange", "sandbox", False), ("exchange", "key", ""), ("exchange", "secret", ""),