From fee3c598d0650b42d1aa75caf098f43f61b413e0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 12 Oct 2023 07:16:56 +0200 Subject: [PATCH] Move schedule to 1 minute after the hour This will avoid congestion at :00, and make sure that the dry-run funding fees are actually already available --- freqtrade/freqtradebot.py | 3 ++- tests/test_freqtradebot.py | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index a9bf80456..97e3cdb21 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -132,7 +132,7 @@ class FreqtradeBot(LoggingMixin): # TODO: This would be more efficient if scheduled in utc time, and performed at each # TODO: funding interval, specified by funding_fee_times on the exchange classes for time_slot in range(0, 24): - for minutes in [0, 30]: + for minutes in [1, 31]: t = str(time(time_slot, minutes, 2)) self._schedule.every().day.at(t).do(update) self.last_process: Optional[datetime] = None @@ -199,6 +199,7 @@ class FreqtradeBot(LoggingMixin): # Only update open orders on startup # This will update the database after the initial migration self.startup_update_open_orders() + # self.update_funding_fees() def process(self) -> None: """ diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 0e61e169f..40d77ce6c 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -5917,16 +5917,17 @@ def test_get_valid_price(mocker, default_conf_usdt) -> None: @pytest.mark.parametrize('trading_mode,calls,t1,t2', [ ('spot', 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"), ('margin', 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"), - ('futures', 15, "2021-09-01 00:00:02", "2021-09-01 08:00:01"), + ('futures', 15, "2021-09-01 00:01:02", "2021-09-01 08:00:01"), + ('futures', 16, "2021-09-01 00:00:02", "2021-09-01 08:00:01"), ('futures', 16, "2021-08-31 23:59:59", "2021-09-01 08:00:01"), ('futures', 16, "2021-09-01 00:00:02", "2021-09-01 08:00:02"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:02"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:03"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:04"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:05"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:06"), - ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:00:07"), - ('futures', 17, "2021-08-31 23:59:58", "2021-09-01 08:00:07"), + ('futures', 16, "2021-08-31 23:59:59", "2021-09-01 08:00:02"), + ('futures', 16, "2021-08-31 23:59:59", "2021-09-01 08:00:03"), + ('futures', 16, "2021-08-31 23:59:59", "2021-09-01 08:00:04"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:01:05"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:01:06"), + ('futures', 17, "2021-08-31 23:59:59", "2021-09-01 08:01:07"), + ('futures', 17, "2021-08-31 23:59:58", "2021-09-01 08:01:07"), ]) def test_update_funding_fees_schedule(mocker, default_conf, trading_mode, calls, time_machine, t1, t2):