Support partially cancelled orders for fee calculation

This commit is contained in:
Matthias
2020-05-01 20:17:22 +02:00
parent 737fc6d198
commit 021e2b58ca
5 changed files with 7 additions and 7 deletions

View File

@@ -1095,7 +1095,8 @@ class Exchange:
# Calculate fee based on order details
if fee_curr in self.get_pair_base_currency(order['symbol']):
# Base currency - divide by amount
return round(order['fee']['cost'] / order['amount'], 8)
return round(
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)