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
|
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
|
Fetch funding fees, either from the exchange (live) or calculates them
|
||||||
based on funding rate/mark price history
|
based on funding rate/mark price history
|
||||||
@ -1856,11 +1856,14 @@ class Exchange:
|
|||||||
:param amount: Trade amount
|
:param amount: Trade amount
|
||||||
:param open_date: Open date of the trade
|
:param open_date: Open date of the trade
|
||||||
"""
|
"""
|
||||||
if self._config['dry_run']:
|
if self.trading_mode == TradingMode.FUTURES:
|
||||||
funding_fees = self._calculate_funding_fees(pair, amount, open_date)
|
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:
|
else:
|
||||||
funding_fees = self._get_funding_fees_from_exchange(pair, open_date)
|
return 0.0
|
||||||
return funding_fees
|
|
||||||
|
|
||||||
@retrier
|
@retrier
|
||||||
def get_funding_rate_history(self, pair: str, since: int) -> Dict:
|
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
|
:param sell_reason: Reason the sell was triggered
|
||||||
:return: True if it succeeds (supported) False (not supported)
|
: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
|
exit_type = 'sell' # TODO-lev: Update to exit
|
||||||
if sell_reason.sell_type in (SellType.STOP_LOSS, SellType.TRAILING_STOP_LOSS):
|
if sell_reason.sell_type in (SellType.STOP_LOSS, SellType.TRAILING_STOP_LOSS):
|
||||||
exit_type = 'stoploss'
|
exit_type = 'stoploss'
|
||||||
|
Loading…
Reference in New Issue
Block a user