Merge pull request #3024 from yazeed/unifying_get_buy_sell_rate_msgs

consistency between get_sell_rate with get_buy_rate
This commit is contained in:
Matthias 2020-03-06 19:32:31 +01:00 committed by GitHub
commit bbdbc59fd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -643,14 +643,16 @@ class FreqtradeBot:
logger.info(f"Using cached sell rate for {pair}.")
return rate
config_ask_strategy = self.config.get('ask_strategy', {})
if config_ask_strategy.get('use_order_book', False):
ask_strategy = self.config.get('ask_strategy', {})
if ask_strategy.get('use_order_book', False):
# This code is only used for notifications, selling uses the generator directly
logger.debug('Using order book to get sell rate')
rate = next(self._order_book_gen(pair, f"{config_ask_strategy['price_side']}s"))
logger.info(
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:
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
return rate