Add test for ask_orderbook validation
This commit is contained in:
@@ -1869,7 +1869,8 @@ def test_get_sell_rate_orderbook_exception(default_conf, mocker, caplog):
|
||||
exchange = get_patched_exchange(mocker, default_conf)
|
||||
with pytest.raises(PricingError):
|
||||
exchange.get_sell_rate(pair, True)
|
||||
assert log_has_re(r"Sell Price at location 1 from orderbook could not be determined\..*", caplog)
|
||||
assert log_has_re(r"Sell Price at location 1 from orderbook could not be determined\..*",
|
||||
caplog)
|
||||
|
||||
|
||||
def test_get_sell_rate_exception(default_conf, mocker, caplog):
|
||||
|
@@ -935,6 +935,23 @@ def test_validate_protections(default_conf, protconf, expected):
|
||||
validate_config_consistency(conf)
|
||||
|
||||
|
||||
def test_validate_ask_orderbook(default_conf, caplog) -> None:
|
||||
conf = deepcopy(default_conf)
|
||||
conf['ask_strategy']['use_order_book'] = True
|
||||
conf['ask_strategy']['order_book_min'] = 2
|
||||
conf['ask_strategy']['order_book_max'] = 2
|
||||
|
||||
validate_config_consistency(conf)
|
||||
assert log_has_re(r"DEPRECATED: Please use `order_book_top` instead of.*", caplog)
|
||||
assert conf['ask_strategy']['order_book_top'] == 2
|
||||
|
||||
conf['ask_strategy']['order_book_max'] = 5
|
||||
|
||||
with pytest.raises(OperationalException,
|
||||
match=r"Using order_book_max != order_book_min in ask_strategy.*"):
|
||||
validate_config_consistency(conf)
|
||||
|
||||
|
||||
def test_load_config_test_comments() -> None:
|
||||
"""
|
||||
Load config with comments
|
||||
|
@@ -4026,7 +4026,8 @@ def test_order_book_ask_strategy(default_conf, limit_buy_order_open, limit_buy_o
|
||||
return_value={'bids': [[]], 'asks': [[]]})
|
||||
with pytest.raises(PricingError):
|
||||
freqtrade.handle_trade(trade)
|
||||
assert log_has_re(r'Sell Price at location 1 from orderbook could not be determined\..*', caplog)
|
||||
assert log_has_re(r'Sell Price at location 1 from orderbook could not be determined\..*',
|
||||
caplog)
|
||||
|
||||
|
||||
def test_startup_state(default_conf, mocker):
|
||||
|
Reference in New Issue
Block a user