Don't require non-mandatory arguments
This commit is contained in:
parent
fe7f3d9c37
commit
16a54b3616
@ -100,12 +100,12 @@ def _validate_price_config(conf: Dict[str, Any]) -> None:
|
|||||||
"""
|
"""
|
||||||
When using market orders, price sides must be using the "other" side of the price
|
When using market orders, price sides must be using the "other" side of the price
|
||||||
"""
|
"""
|
||||||
if (conf['order_types'].get('buy') == 'market'
|
if (conf.get('order_types', {}).get('buy') == 'market'
|
||||||
and conf['bid_strategy'].get('price_side') != 'ask'):
|
and conf.get('bid_strategy', {}).get('price_side') != 'ask'):
|
||||||
raise OperationalException('Market buy orders require bid_strategy.price_side = "ask".')
|
raise OperationalException('Market buy orders require bid_strategy.price_side = "ask".')
|
||||||
|
|
||||||
if (conf['order_types'].get('sell') == 'market'
|
if (conf.get('order_types', {}).get('sell') == 'market'
|
||||||
and conf['ask_strategy'].get('price_side') != 'bid'):
|
and conf.get('ask_strategy', {}).get('price_side') != 'bid'):
|
||||||
raise OperationalException('Market sell orders require ask_strategy.price_side = "bid".')
|
raise OperationalException('Market sell orders require ask_strategy.price_side = "bid".')
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,6 +94,7 @@ def test_order_dict_dry_run(default_conf, mocker, caplog) -> None:
|
|||||||
'stoploss': 'limit',
|
'stoploss': 'limit',
|
||||||
'stoploss_on_exchange': True,
|
'stoploss_on_exchange': True,
|
||||||
}
|
}
|
||||||
|
conf['bid_strategy']['price_side'] = 'ask'
|
||||||
|
|
||||||
freqtrade = FreqtradeBot(conf)
|
freqtrade = FreqtradeBot(conf)
|
||||||
assert freqtrade.strategy.order_types['stoploss_on_exchange']
|
assert freqtrade.strategy.order_types['stoploss_on_exchange']
|
||||||
@ -128,6 +129,7 @@ def test_order_dict_live(default_conf, mocker, caplog) -> None:
|
|||||||
'stoploss': 'limit',
|
'stoploss': 'limit',
|
||||||
'stoploss_on_exchange': True,
|
'stoploss_on_exchange': True,
|
||||||
}
|
}
|
||||||
|
conf['bid_strategy']['price_side'] = 'ask'
|
||||||
|
|
||||||
freqtrade = FreqtradeBot(conf)
|
freqtrade = FreqtradeBot(conf)
|
||||||
assert not log_has_re(".*stoploss_on_exchange .* dry-run", caplog)
|
assert not log_has_re(".*stoploss_on_exchange .* dry-run", caplog)
|
||||||
|
Loading…
Reference in New Issue
Block a user