Fix bug pointed out in #679

This commit is contained in:
Matthias Voppichler 2018-05-15 19:49:28 +02:00
parent 58a2af8d80
commit 263bf918b1

View File

@ -397,7 +397,7 @@ class FreqtradeBot(object):
return order_amount return order_amount
# use fee from order-dict if possible # use fee from order-dict if possible
if 'fee' in order and order['fee']: if 'fee' in order and order['fee'] and (order['fee'].keys() >= {'currency', 'cost'}):
if trade.pair.startswith(order['fee']['currency']): if trade.pair.startswith(order['fee']['currency']):
new_amount = order_amount - order['fee']['cost'] new_amount = order_amount - order['fee']['cost']
logger.info("Applying fee on amount for %s (from %s to %s) from Order", logger.info("Applying fee on amount for %s (from %s to %s) from Order",
@ -414,7 +414,7 @@ class FreqtradeBot(object):
fee_abs = 0 fee_abs = 0
for exectrade in trades: for exectrade in trades:
amount += exectrade['amount'] amount += exectrade['amount']
if "fee" in exectrade: if "fee" in exectrade and (exectrade['fee'].keys() >= {'currency', 'cost'}):
# only applies if fee is in quote currency! # only applies if fee is in quote currency!
if trade.pair.startswith(exectrade['fee']['currency']): if trade.pair.startswith(exectrade['fee']['currency']):
fee_abs += exectrade['fee']['cost'] fee_abs += exectrade['fee']['cost']