From a2551daf12c68434449ea512433482cfc2736696 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 2 Jun 2020 20:55:12 +0200 Subject: [PATCH] Fix ZeroDivision problem where cost is 0.0 --- freqtrade/exchange/exchange.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 7ef0d7750..4acee710a 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -1104,9 +1104,12 @@ class Exchange: order['fee']['cost'] / safe_value_fallback(order, order, 'filled', 'amount'), 8) elif fee_curr in self.get_pair_quote_currency(order['symbol']): # Quote currency - divide by cost - return round(order['fee']['cost'] / order['cost'], 8) + return round(order['fee']['cost'] / order['cost'], 8) if order['cost'] else None else: # If Fee currency is a different currency + if not order['cost']: + # If cost is None or 0.0 -> falsy, return None + return None try: comb = self.get_valid_pair_combination(fee_curr, self._config['stake_currency']) tick = self.fetch_ticker(comb)