Verify if fee for this side has been updated

This commit is contained in:
Matthias
2020-05-01 19:54:16 +02:00
parent 6b33d5af1e
commit 6d620ba1f6
3 changed files with 16 additions and 1 deletions

View File

@@ -1174,7 +1174,7 @@ class FreqtradeBot:
if order_amount is None:
order_amount = order['amount']
# Only run for closed orders
if trade.fee_open_currency is not None or order['status'] == 'open':
if trade.fee_updated(order['side']) or order['status'] == 'open':
return order_amount
trade_base_currency = self.exchange.get_pair_base_currency(trade.pair)

View File

@@ -394,6 +394,15 @@ class Trade(_DECL_BASE):
if fee_rate is not None:
self.fee_close = fee_rate
def fee_updated(self, side: str) -> bool:
"""
Verify if this side (buy / sell) has already been updated
"""
if side == 'buy':
return self.fee_open_currency is not None
elif side == 'sell':
return self.fee_close_currency is not None
def _calc_open_trade_price(self) -> float:
"""
Calculate the open_rate including open_fee.