mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
exchange.get_funding_fees returns 0 by default
This commit is contained in:
parent
9a65f486ed
commit
c8c2d89893
|
@ -1848,7 +1848,7 @@ class Exchange:
|
|||
|
||||
return fees
|
||||
|
||||
def get_funding_fees(self, pair: str, amount: float, open_date: datetime):
|
||||
def get_funding_fees(self, pair: str, amount: float, open_date: datetime) -> float:
|
||||
"""
|
||||
Fetch funding fees, either from the exchange (live) or calculates them
|
||||
based on funding rate/mark price history
|
||||
|
@ -1856,11 +1856,14 @@ class Exchange:
|
|||
:param amount: Trade amount
|
||||
:param open_date: Open date of the trade
|
||||
"""
|
||||
if self._config['dry_run']:
|
||||
funding_fees = self._calculate_funding_fees(pair, amount, open_date)
|
||||
if self.trading_mode == TradingMode.FUTURES:
|
||||
if self._config['dry_run']:
|
||||
funding_fees = self._calculate_funding_fees(pair, amount, open_date)
|
||||
else:
|
||||
funding_fees = self._get_funding_fees_from_exchange(pair, open_date)
|
||||
return funding_fees
|
||||
else:
|
||||
funding_fees = self._get_funding_fees_from_exchange(pair, open_date)
|
||||
return funding_fees
|
||||
return 0.0
|
||||
|
||||
@retrier
|
||||
def get_funding_rate_history(self, pair: str, since: int) -> Dict:
|
||||
|
|
|
@ -1262,7 +1262,11 @@ class FreqtradeBot(LoggingMixin):
|
|||
:param sell_reason: Reason the sell was triggered
|
||||
:return: True if it succeeds (supported) False (not supported)
|
||||
"""
|
||||
trade.funding_fees = self.exchange.get_funding_fees(trade.pair, trade.amount, trade.open_date)
|
||||
trade.funding_fees = self.exchange.get_funding_fees(
|
||||
trade.pair,
|
||||
trade.amount,
|
||||
trade.open_date
|
||||
)
|
||||
exit_type = 'sell' # TODO-lev: Update to exit
|
||||
if sell_reason.sell_type in (SellType.STOP_LOSS, SellType.TRAILING_STOP_LOSS):
|
||||
exit_type = 'stoploss'
|
||||
|
|
Loading…
Reference in New Issue
Block a user