mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Add test for order-types migration
This commit is contained in:
parent
420cc5c595
commit
943d080f5e
|
@ -244,7 +244,7 @@ def _validate_order_types(conf: Dict[str, Any]) -> None:
|
|||
else:
|
||||
logger.warning(
|
||||
"DEPRECATED: Using 'buy' and 'sell' for order_types is deprecated."
|
||||
"Please migrate your time_in_force settings to use 'entry' and 'exit' wording."
|
||||
"Please migrate your order_types settings to use 'entry' and 'exit' wording."
|
||||
)
|
||||
for o, n in [
|
||||
('buy', 'entry'),
|
||||
|
@ -255,8 +255,3 @@ def _validate_order_types(conf: Dict[str, Any]) -> None:
|
|||
]:
|
||||
|
||||
process_deprecated_setting(conf, 'order_types', o, 'order_types', n)
|
||||
# order_types['entry'] = order_types.pop('buy')
|
||||
# order_types['exit'] = order_types.pop('sell')
|
||||
# order_types['emergencyexit'] = order_types.pop('emergencysell')
|
||||
# order_types['forceexit'] = order_types.pop('forceexit')
|
||||
# order_types['forceentry'] = order_types.pop('forceentry')
|
||||
|
|
|
@ -963,6 +963,40 @@ def test_validate_time_in_force(default_conf, caplog) -> None:
|
|||
validate_config_consistency(conf)
|
||||
|
||||
|
||||
def test_validate_order_types(default_conf, caplog) -> None:
|
||||
conf = deepcopy(default_conf)
|
||||
conf['order_types'] = {
|
||||
'buy': 'limit',
|
||||
'sell': 'market',
|
||||
'forcesell': 'market',
|
||||
'forcebuy': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False,
|
||||
}
|
||||
validate_config_consistency(conf)
|
||||
assert log_has_re(r"DEPRECATED: Using 'buy' and 'sell' for order_types is.*", caplog)
|
||||
assert conf['order_types']['entry'] == 'limit'
|
||||
assert conf['order_types']['exit'] == 'market'
|
||||
assert conf['order_types']['forceentry'] == 'limit'
|
||||
assert 'buy' not in conf['order_types']
|
||||
assert 'sell' not in conf['order_types']
|
||||
assert 'forcebuy' not in conf['order_types']
|
||||
assert 'forcesell' not in conf['order_types']
|
||||
|
||||
conf = deepcopy(default_conf)
|
||||
conf['order_types'] = {
|
||||
'buy': 'limit',
|
||||
'sell': 'market',
|
||||
'forcesell': 'market',
|
||||
'forcebuy': 'limit',
|
||||
'stoploss': 'market',
|
||||
'stoploss_on_exchange': False,
|
||||
}
|
||||
conf['trading_mode'] = 'futures'
|
||||
with pytest.raises(OperationalException,
|
||||
match=r"Please migrate your order_types settings to use the new wording\."):
|
||||
validate_config_consistency(conf)
|
||||
|
||||
def test_load_config_test_comments() -> None:
|
||||
"""
|
||||
Load config with comments
|
||||
|
|
Loading…
Reference in New Issue
Block a user