separated hours_to_time to utils folder
This commit is contained in:
parent
8bcd444775
commit
cdefd15b28
@ -8,7 +8,7 @@ from freqtrade.exchange.binance import Binance
|
||||
from freqtrade.exchange.bittrex import Bittrex
|
||||
from freqtrade.exchange.bybit import Bybit
|
||||
from freqtrade.exchange.coinbasepro import Coinbasepro
|
||||
from freqtrade.exchange.exchange import (available_exchanges, ccxt_exchanges, hours_to_time,
|
||||
from freqtrade.exchange.exchange import (available_exchanges, ccxt_exchanges,
|
||||
is_exchange_known_ccxt, is_exchange_officially_supported,
|
||||
market_is_active, timeframe_to_minutes, timeframe_to_msecs,
|
||||
timeframe_to_next_date, timeframe_to_prev_date,
|
||||
|
@ -6,9 +6,9 @@ import ccxt
|
||||
from datetime import time
|
||||
from freqtrade.exceptions import (DDosProtection, InsufficientFundsError, InvalidOrderException,
|
||||
OperationalException, TemporaryError)
|
||||
from freqtrade.exchange import Exchange, hours_to_time
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.exchange.common import retrier
|
||||
|
||||
from freqtrade.utils import hours_to_time
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1556,15 +1556,6 @@ class Exchange:
|
||||
raise OperationalException(e) from e
|
||||
|
||||
|
||||
def hours_to_time(hours: List[int]) -> List[time]:
|
||||
'''
|
||||
:param hours: a list of hours as a time of day (e.g. [1, 16] is 01:00 and 16:00 o'clock)
|
||||
:return: a list of datetime time objects that correspond to the hours in hours
|
||||
'''
|
||||
# TODO-lev: These must be utc time
|
||||
return [datetime.strptime(str(t), '%H').time() for t in hours]
|
||||
|
||||
|
||||
def is_exchange_known_ccxt(exchange_name: str, ccxt_module: CcxtModuleType = None) -> bool:
|
||||
return exchange_name in ccxt_exchanges(ccxt_module)
|
||||
|
||||
|
@ -6,10 +6,10 @@ import ccxt
|
||||
from datetime import time
|
||||
from freqtrade.exceptions import (DDosProtection, InsufficientFundsError, InvalidOrderException,
|
||||
OperationalException, TemporaryError)
|
||||
from freqtrade.exchange import Exchange, hours_to_time
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.exchange.common import API_FETCH_ORDER_RETRY_COUNT, retrier
|
||||
from freqtrade.misc import safe_value_fallback2
|
||||
|
||||
from freqtrade.utils import hours_to_time
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -6,9 +6,9 @@ import ccxt
|
||||
from datetime import time
|
||||
from freqtrade.exceptions import (DDosProtection, InsufficientFundsError, InvalidOrderException,
|
||||
OperationalException, TemporaryError)
|
||||
from freqtrade.exchange import Exchange, hours_to_time
|
||||
from freqtrade.exchange import Exchange
|
||||
from freqtrade.exchange.common import retrier
|
||||
|
||||
from freqtrade.utils import hours_to_time
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
2
freqtrade/utils/__init__.py
Normal file
2
freqtrade/utils/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
# flake8: noqa: F401
|
||||
from freqtrade.utils.hours_to_time import hours_to_time
|
11
freqtrade/utils/hours_to_time.py
Normal file
11
freqtrade/utils/hours_to_time.py
Normal file
@ -0,0 +1,11 @@
|
||||
from datetime import datetime, time
|
||||
from typing import List
|
||||
|
||||
|
||||
def hours_to_time(hours: List[int]) -> List[time]:
|
||||
'''
|
||||
:param hours: a list of hours as a time of day (e.g. [1, 16] is 01:00 and 16:00 o'clock)
|
||||
:return: a list of datetime time objects that correspond to the hours in hours
|
||||
'''
|
||||
# TODO-lev: These must be utc time
|
||||
return [datetime.strptime(str(t), '%H').time() for t in hours]
|
Loading…
Reference in New Issue
Block a user