Skip to content

Commit

Permalink
Merge 17293cb into a7b8de9
Browse files Browse the repository at this point in the history
  • Loading branch information
samgermain committed Jul 28, 2021
2 parents a7b8de9 + 17293cb commit 3ae181c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions freqtrade/exchange/exchange.py
Expand Up @@ -1022,8 +1022,12 @@ def get_rate(self, pair: str, refresh: bool, side: str) -> float:
return rate

conf_strategy = self._config.get(strat_name, {})
use_order_book = (
('use_order_book' in conf_strategy or side == "sell") and
conf_strategy.get('use_order_book', False)
)

if conf_strategy.get('use_order_book', False) and ('use_order_book' in conf_strategy):
if use_order_book:

order_book_top = conf_strategy.get('order_book_top', 1)
order_book = self.fetch_l2_order_book(pair, order_book_top)
Expand Down Expand Up @@ -1053,8 +1057,8 @@ def get_rate(self, pair: str, refresh: bool, side: str) -> float:
ticker_rate = ticker_rate - balance * (ticker_rate - ticker['last'])
rate = ticker_rate

if rate is None:
raise PricingError(f"{name}-Rate for {pair} was empty.")
if rate is None and side == "sell":
raise PricingError(f"Sell-Rate for {pair} was empty.")
cache_rate[pair] = rate

return rate
Expand Down

0 comments on commit 3ae181c

Please sign in to comment.