diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 49468ce29..f50c024e9 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -1711,6 +1711,8 @@ class Exchange: def _get_funding_fee_dates(self, d1: datetime, d2: datetime): d1_hours = d1.hour + 1 if self.funding_fee_cutoff(d1) else d1.hour + if d1_hours == 24: + d1_hours = 0 d1 = datetime(d1.year, d1.month, d1.day, d1_hours, tzinfo=timezone.utc) d2 = datetime(d2.year, d2.month, d2.day, d2.hour, tzinfo=timezone.utc) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index a046f85b9..0cb99c7bf 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -275,7 +275,7 @@ class FreqtradeBot(LoggingMixin): trade.pair, trade.amount, trade.open_date - ) + ) + (trade.funding_fees or 0.0) else: funding_fees = self.exchange.get_funding_fees_from_exchange( trade.pair, diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index c021da231..b223c9097 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -4718,7 +4718,7 @@ def test_update_funding_fees(mocker, default_conf, time_machine, fee): time: 0, mark: 1.2, fundRate: 0.00049426, nominal_value: 147.6, fundFee: 0.072952776 time: 8, mark: 1.2, fundRate: 0.00032715, nominal_value: 147.6, fundFee: 0.04828734 ''' - time_machine.move_to("2021-09-01 00:00:00") + time_machine.move_to("2021-09-01 00:00:00 +00:00") funding_rates = { "LTC/BTC": {