use "fees" for trades responses

This commit is contained in:
Matthias 2022-07-07 19:40:16 +02:00
parent 81f7d77d74
commit 5b733a723d
2 changed files with 9 additions and 6 deletions

View File

@ -1644,10 +1644,6 @@ class Exchange:
return fee.get('rate')
fee_curr = fee.get('currency')
if fee_curr is None:
# Auto-currency only in futures mode
if self.trading_mode == TradingMode.FUTURES:
fee_curr = self.get_pair_quote_currency(symbol)
else:
return None
# Calculate fee based on order details
if fee_curr == self.get_pair_base_currency(symbol):

View File

@ -1777,12 +1777,19 @@ class FreqtradeBot(LoggingMixin):
fee_abs = 0.0
fee_cost = 0.0
trade_base_currency = self.exchange.get_pair_base_currency(trade.pair)
fee_rate_array: List[float] = []
for exectrade in trades:
amount += exectrade['amount']
if self.exchange.order_has_fee(exectrade):
# Prefer singular fee
fees = [exectrade['fee']]
else:
fees = exectrade.get('fees', [])
for fee in fees:
fee_cost_, fee_currency, fee_rate_ = self.exchange.extract_cost_curr_rate(
exectrade['fee'], exectrade['symbol'], exectrade['cost'], exectrade['amount']
fee, exectrade['symbol'], exectrade['cost'], exectrade['amount']
)
fee_cost += fee_cost_
if fee_rate_ is not None: