mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Adjusted time to utc in schedule
This commit is contained in:
parent
e367f84b06
commit
39be675f1f
|
@ -4,7 +4,7 @@ Freqtrade is the main module of this bot. It contains the class Freqtrade()
|
|||
import copy
|
||||
import logging
|
||||
import traceback
|
||||
from datetime import datetime, time, timezone
|
||||
from datetime import datetime, time, timedelta, timezone
|
||||
from math import isclose
|
||||
from threading import Lock
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
@ -117,9 +117,20 @@ class FreqtradeBot(LoggingMixin):
|
|||
self.wallets.update()
|
||||
|
||||
for time_slot in self.exchange.funding_fee_times:
|
||||
t = str(time(time_slot))
|
||||
t = str(time(self.utc_hour_to_local(time_slot)))
|
||||
schedule.every().day.at(t).do(update)
|
||||
|
||||
def utc_hour_to_local(self, hour):
|
||||
local_timezone = datetime.now(
|
||||
timezone.utc).astimezone().tzinfo
|
||||
local_time = datetime.now(local_timezone)
|
||||
offset = local_time.utcoffset().total_seconds()
|
||||
td = timedelta(seconds=offset)
|
||||
t = datetime.strptime(f'26 Sep 2021 {hour}:00:00', '%d %b %Y %H:%M:%S')
|
||||
utc = t + td
|
||||
print(hour, utc)
|
||||
return int(utc.strftime("%H").lstrip("0") or 0)
|
||||
|
||||
def notify_status(self, msg: str) -> None:
|
||||
"""
|
||||
Public method for users of this class (worker, etc.) to send notifications
|
||||
|
|
Loading…
Reference in New Issue
Block a user