Fix ZeroDivision problem where cost is 0.0
This commit is contained in:
parent
ea954b4338
commit
a2551daf12
@ -1104,9 +1104,12 @@ class Exchange:
|
|||||||
order['fee']['cost'] / safe_value_fallback(order, order, 'filled', 'amount'), 8)
|
order['fee']['cost'] / safe_value_fallback(order, order, 'filled', 'amount'), 8)
|
||||||
elif fee_curr in self.get_pair_quote_currency(order['symbol']):
|
elif fee_curr in self.get_pair_quote_currency(order['symbol']):
|
||||||
# Quote currency - divide by cost
|
# 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:
|
else:
|
||||||
# If Fee currency is a different currency
|
# If Fee currency is a different currency
|
||||||
|
if not order['cost']:
|
||||||
|
# If cost is None or 0.0 -> falsy, return None
|
||||||
|
return None
|
||||||
try:
|
try:
|
||||||
comb = self.get_valid_pair_combination(fee_curr, self._config['stake_currency'])
|
comb = self.get_valid_pair_combination(fee_curr, self._config['stake_currency'])
|
||||||
tick = self.fetch_ticker(comb)
|
tick = self.fetch_ticker(comb)
|
||||||
|
Loading…
Reference in New Issue
Block a user