Merge pull request #3490 from freqtrade/fix/timeframe_collision
Fix bug in timeframe deprecation
This commit is contained in:
commit
5e99be0a32
@ -72,4 +72,9 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
|
|||||||
"DEPRECATED: "
|
"DEPRECATED: "
|
||||||
"Please use 'timeframe' instead of 'ticker_interval."
|
"Please use 'timeframe' instead of 'ticker_interval."
|
||||||
)
|
)
|
||||||
|
if 'timeframe' in config:
|
||||||
|
raise OperationalException(
|
||||||
|
"Both 'timeframe' and 'ticker_interval' detected."
|
||||||
|
"Please remove 'ticker_interval' from your configuration to continue operating."
|
||||||
|
)
|
||||||
config['timeframe'] = config['ticker_interval']
|
config['timeframe'] = config['ticker_interval']
|
||||||
|
@ -1144,11 +1144,21 @@ def test_process_deprecated_setting(mocker, default_conf, caplog):
|
|||||||
|
|
||||||
def test_process_deprecated_ticker_interval(mocker, default_conf, caplog):
|
def test_process_deprecated_ticker_interval(mocker, default_conf, caplog):
|
||||||
message = "DEPRECATED: Please use 'timeframe' instead of 'ticker_interval."
|
message = "DEPRECATED: Please use 'timeframe' instead of 'ticker_interval."
|
||||||
process_temporary_deprecated_settings(default_conf)
|
config = deepcopy(default_conf)
|
||||||
|
process_temporary_deprecated_settings(config)
|
||||||
assert not log_has(message, caplog)
|
assert not log_has(message, caplog)
|
||||||
|
|
||||||
del default_conf['timeframe']
|
del config['timeframe']
|
||||||
default_conf['ticker_interval'] = '15m'
|
config['ticker_interval'] = '15m'
|
||||||
process_temporary_deprecated_settings(default_conf)
|
process_temporary_deprecated_settings(config)
|
||||||
assert log_has(message, caplog)
|
assert log_has(message, caplog)
|
||||||
assert default_conf['ticker_interval'] == '15m'
|
assert config['ticker_interval'] == '15m'
|
||||||
|
|
||||||
|
config = deepcopy(default_conf)
|
||||||
|
# Have both timeframe and ticker interval in config
|
||||||
|
# Can also happen when using ticker_interval in configuration, and --timeframe as cli argument
|
||||||
|
config['timeframe'] = '5m'
|
||||||
|
config['ticker_interval'] = '4h'
|
||||||
|
with pytest.raises(OperationalException,
|
||||||
|
match=r"Both 'timeframe' and 'ticker_interval' detected."):
|
||||||
|
process_temporary_deprecated_settings(config)
|
||||||
|
Loading…
Reference in New Issue
Block a user