Add simple verification that orderflow is configured correctly

This commit is contained in:
Matthias
2024-03-17 19:31:29 +01:00
parent 7e387f96ab
commit 1d5f2b64a2
2 changed files with 23 additions and 0 deletions

View File

@@ -89,6 +89,7 @@ def validate_config_consistency(conf: Dict[str, Any], *, preliminary: bool = Fal
_validate_freqai_include_timeframes(conf, preliminary=preliminary)
_validate_consumers(conf)
validate_migrated_strategy_settings(conf)
_validate_orderflow(conf)
# validate configuration before returning
logger.info('Validating configuration ...')
@@ -399,6 +400,14 @@ def _validate_consumers(conf: Dict[str, Any]) -> None:
"please set `process_only_new_candles` to False")
def _validate_orderflow(conf: Dict[str, Any]) -> None:
if conf.get('exchange', {}).get('use_public_trades'):
if 'orderflow' not in conf:
raise OperationalException(
"Orderflow is a required configuration key when using public trades."
)
def _strategy_settings(conf: Dict[str, Any]) -> None:
process_deprecated_setting(conf, None, 'use_sell_signal', None, 'use_exit_signal')

View File

@@ -992,6 +992,20 @@ def test__validate_consumers(default_conf, caplog) -> None:
assert log_has_re("To receive best performance with external data.*", caplog)
def test__validate_orderflow(default_conf) -> None:
conf = deepcopy(default_conf)
conf['exchange']['use_public_trades'] = True
with pytest.raises(OperationalException,
match="Orderflow is a required configuration key when using public trades."):
validate_config_consistency(conf)
conf.update({'orderflow': {
"scale": 0.5,
}})
# Should pass.
validate_config_consistency(conf)
def test_load_config_test_comments() -> None:
"""
Load config with comments