From a3c52445ee740b66bb85bba3997ae9d658e79688 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 16 Jul 2024 07:14:46 +0200 Subject: [PATCH] Simplify validation --- freqtrade/configuration/config_validation.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/freqtrade/configuration/config_validation.py b/freqtrade/configuration/config_validation.py index 597752614..4bb260b52 100644 --- a/freqtrade/configuration/config_validation.py +++ b/freqtrade/configuration/config_validation.py @@ -207,15 +207,12 @@ def _validate_protections(conf: Dict[str, Any]) -> None: f"Please fix the protection {prot.get('method')}." ) - if parsed_unlock_at is not None and "stop_duration" in prot: + if parsed_unlock_at is not None and ( + "stop_duration" in prot or "stop_duration_candles" in prot + ): raise ConfigurationError( - "Protections must specify either `unlock_at` or `stop_duration`.\n" - f"Please fix the protection {prot.get('method')}." - ) - - if parsed_unlock_at is not None and "stop_duration_candles" in prot: - raise ConfigurationError( - "Protections must specify either `unlock_at` or `stop_duration_candles`.\n" + "Protections must specify either `unlock_at`, `stop_duration` or " + "`stop_duration_candles`.\n" f"Please fix the protection {prot.get('method')}." )