Switched shcedule to perform every 15 minutes
This commit is contained in:
parent
95be5121ec
commit
3b962433fb
@ -116,28 +116,12 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
self.update_funding_fees()
|
self.update_funding_fees()
|
||||||
self.wallets.update()
|
self.wallets.update()
|
||||||
|
|
||||||
local_timezone = datetime.now(
|
# TODO: This would be more efficient if scheduled in utc time, and performed at each
|
||||||
timezone.utc).astimezone().tzinfo
|
# TODO: funding interval, specified by funding_fee_times on the exchange classes
|
||||||
minutes = self.time_zone_minutes(local_timezone)
|
|
||||||
for time_slot in range(0, 24):
|
for time_slot in range(0, 24):
|
||||||
t = str(time(time_slot, minutes))
|
for minutes in [0, 15, 30, 45]:
|
||||||
schedule.every().day.at(t).do(update)
|
t = str(time(time_slot, minutes))
|
||||||
|
schedule.every().day.at(t).do(update)
|
||||||
def time_zone_minutes(self, local_timezone):
|
|
||||||
"""
|
|
||||||
Returns the minute offset of a timezone
|
|
||||||
:param local_timezone: The operating systems timezone
|
|
||||||
"""
|
|
||||||
local_time = datetime.now(local_timezone)
|
|
||||||
offset = local_time.utcoffset().total_seconds()
|
|
||||||
half_hour_tz = (offset * 2) % 2 != 0.0
|
|
||||||
quart_hour_tz = (offset * 4) % 4 != 0.0
|
|
||||||
if quart_hour_tz:
|
|
||||||
return 45
|
|
||||||
elif half_hour_tz:
|
|
||||||
return 30
|
|
||||||
else:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def notify_status(self, msg: str) -> None:
|
def notify_status(self, msg: str) -> None:
|
||||||
"""
|
"""
|
||||||
|
@ -4285,8 +4285,8 @@ def test_get_valid_price(mocker, default_conf_usdt) -> None:
|
|||||||
@pytest.mark.parametrize('trading_mode,calls,t1,t2', [
|
@pytest.mark.parametrize('trading_mode,calls,t1,t2', [
|
||||||
(TradingMode.SPOT, 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"),
|
(TradingMode.SPOT, 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"),
|
||||||
(TradingMode.MARGIN, 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"),
|
(TradingMode.MARGIN, 0, "2021-09-01 00:00:00", "2021-09-01 08:00:00"),
|
||||||
(TradingMode.FUTURES, 8, "2021-09-01 00:00:01", "2021-09-01 08:00:00"),
|
(TradingMode.FUTURES, 32, "2021-09-01 00:00:01", "2021-09-01 08:00:00"),
|
||||||
(TradingMode.FUTURES, 9, "2021-08-31 23:59:59", "2021-09-01 08:00:01"),
|
(TradingMode.FUTURES, 33, "2021-08-31 23:59:59", "2021-09-01 08:00:01"),
|
||||||
])
|
])
|
||||||
def test_update_funding_fees(mocker, default_conf, trading_mode, calls, time_machine,
|
def test_update_funding_fees(mocker, default_conf, trading_mode, calls, time_machine,
|
||||||
t1, t2):
|
t1, t2):
|
||||||
@ -4303,28 +4303,3 @@ def test_update_funding_fees(mocker, default_conf, trading_mode, calls, time_mac
|
|||||||
schedule.run_pending()
|
schedule.run_pending()
|
||||||
|
|
||||||
assert freqtrade.update_funding_fees.call_count == calls
|
assert freqtrade.update_funding_fees.call_count == calls
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('tz,minute_offset', [
|
|
||||||
('IST', 30),
|
|
||||||
('ACST', 30),
|
|
||||||
('ACWST', 45),
|
|
||||||
('ACST', 30),
|
|
||||||
('ACDT', 30),
|
|
||||||
('CCT', 30),
|
|
||||||
('CHAST', 45),
|
|
||||||
('NST', 30),
|
|
||||||
('IST', 30),
|
|
||||||
('AFT', 30),
|
|
||||||
('IRST', 30),
|
|
||||||
('IRDT', 30),
|
|
||||||
('MMT', 30),
|
|
||||||
('NPT', 45),
|
|
||||||
('MART', 30),
|
|
||||||
])
|
|
||||||
def test_time_zone_minutes(mocker, default_conf, tz, minute_offset):
|
|
||||||
patch_RPCManager(mocker)
|
|
||||||
patch_exchange(mocker)
|
|
||||||
freqtrade = get_patched_freqtradebot(mocker, default_conf)
|
|
||||||
return freqtrade
|
|
||||||
# freqtrade.time_zone_minutes(tzinfo('IST'))
|
|
||||||
|
Loading…
Reference in New Issue
Block a user