mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
use "fees" for trades responses
This commit is contained in:
parent
81f7d77d74
commit
5b733a723d
|
@ -1644,11 +1644,7 @@ 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
|
||||
return None
|
||||
# Calculate fee based on order details
|
||||
if fee_curr == self.get_pair_base_currency(symbol):
|
||||
# Base currency - divide by amount
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user