Add simple verification that orderflow is configured correctly
This commit is contained in:
@@ -89,6 +89,7 @@ def validate_config_consistency(conf: Dict[str, Any], *, preliminary: bool = Fal
|
|||||||
_validate_freqai_include_timeframes(conf, preliminary=preliminary)
|
_validate_freqai_include_timeframes(conf, preliminary=preliminary)
|
||||||
_validate_consumers(conf)
|
_validate_consumers(conf)
|
||||||
validate_migrated_strategy_settings(conf)
|
validate_migrated_strategy_settings(conf)
|
||||||
|
_validate_orderflow(conf)
|
||||||
|
|
||||||
# validate configuration before returning
|
# validate configuration before returning
|
||||||
logger.info('Validating configuration ...')
|
logger.info('Validating configuration ...')
|
||||||
@@ -399,6 +400,14 @@ def _validate_consumers(conf: Dict[str, Any]) -> None:
|
|||||||
"please set `process_only_new_candles` to False")
|
"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:
|
def _strategy_settings(conf: Dict[str, Any]) -> None:
|
||||||
|
|
||||||
process_deprecated_setting(conf, None, 'use_sell_signal', None, 'use_exit_signal')
|
process_deprecated_setting(conf, None, 'use_sell_signal', None, 'use_exit_signal')
|
||||||
|
|||||||
@@ -992,6 +992,20 @@ def test__validate_consumers(default_conf, caplog) -> None:
|
|||||||
assert log_has_re("To receive best performance with external data.*", caplog)
|
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:
|
def test_load_config_test_comments() -> None:
|
||||||
"""
|
"""
|
||||||
Load config with comments
|
Load config with comments
|
||||||
|
|||||||
Reference in New Issue
Block a user