unifying get_sell_rate with get_buy_rate

This commit is contained in:
Yazeed Al Oyoun 2020-03-05 20:44:29 +01:00
parent 459f1aa130
commit 4474482307

View File

@ -643,14 +643,16 @@ class FreqtradeBot:
logger.info(f"Using cached sell rate for {pair}.") logger.info(f"Using cached sell rate for {pair}.")
return rate return rate
config_ask_strategy = self.config.get('ask_strategy', {}) ask_strategy = self.config.get('ask_strategy', {})
if config_ask_strategy.get('use_order_book', False): if ask_strategy.get('use_order_book', False):
# This code is only used for notifications, selling uses the generator directly # This code is only used for notifications, selling uses the generator directly
logger.debug('Using order book to get sell rate') logger.info(
rate = next(self._order_book_gen(pair, f"{config_ask_strategy['price_side']}s")) f"Getting price from order book {ask_strategy['price_side'].capitalize()} side."
)
rate = next(self._order_book_gen(pair, f"{ask_strategy['price_side']}s"))
else: else:
rate = self.exchange.fetch_ticker(pair)[config_ask_strategy['price_side']] rate = self.exchange.fetch_ticker(pair)[ask_strategy['price_side']]
self._sell_rate_cache[pair] = rate self._sell_rate_cache[pair] = rate
return rate return rate