Add test for ask_orderbook validation

This commit is contained in:
Matthias
2021-06-25 20:51:45 +02:00
parent 8c542e4028
commit 59a33d0fa9
5 changed files with 24 additions and 5 deletions

View File

@@ -193,7 +193,7 @@ def _validate_ask_orderbook(conf: Dict[str, Any]) -> None:
ask_strategy = conf.get('ask_strategy', {})
ob_min = ask_strategy.get('order_book_min')
ob_max = ask_strategy.get('order_book_max')
if ob_min is not None and ob_max is not None:
if ob_min is not None and ob_max is not None and ask_strategy.get('use_order_book'):
if ob_min != ob_max:
raise OperationalException(
"Using order_book_max != order_book_min in ask_strategy is no longer supported."

View File

@@ -1071,8 +1071,8 @@ class Exchange:
rate = order_book[f"{ask_strategy['price_side']}s"][order_book_top - 1][0]
except (IndexError, KeyError) as e:
logger.warning(
"Sell Price at location from orderbook could not be determined."
f"Orderbook: {order_book}"
f"Sell Price at location {order_book_top} from orderbook could not be "
f"determined. Orderbook: {order_book}"
)
raise PricingError from e
else: