From 115586a50f2cc96580ce0fa989b68995fd9d087d Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Mon, 18 May 2020 21:59:50 +0300 Subject: [PATCH] Introduce freqtrade.typing --- freqtrade/data/dataprovider.py | 2 +- freqtrade/exchange/exchange.py | 2 +- freqtrade/pairlist/pairlistmanager.py | 7 ++----- freqtrade/strategy/interface.py | 2 +- freqtrade/typing.py | 8 ++++++++ 5 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 freqtrade/typing.py diff --git a/freqtrade/data/dataprovider.py b/freqtrade/data/dataprovider.py index 5668e2437..ef03307cc 100644 --- a/freqtrade/data/dataprovider.py +++ b/freqtrade/data/dataprovider.py @@ -12,8 +12,8 @@ from pandas import DataFrame from freqtrade.data.history import load_pair_history from freqtrade.exceptions import DependencyException, OperationalException from freqtrade.exchange import Exchange -from freqtrade.pairlist.pairlistmanager import ListPairsWithTimeframes from freqtrade.state import RunMode +from freqtrade.typing import ListPairsWithTimeframes logger = logging.getLogger(__name__) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 36d1ddca4..c60eb766a 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -23,7 +23,7 @@ from freqtrade.exceptions import (DependencyException, InvalidOrderException, OperationalException, TemporaryError) from freqtrade.exchange.common import BAD_EXCHANGES, retrier, retrier_async from freqtrade.misc import deep_merge_dicts, safe_value_fallback -from freqtrade.pairlist.pairlistmanager import ListPairsWithTimeframes +from freqtrade.typing import ListPairsWithTimeframes CcxtModuleType = Any diff --git a/freqtrade/pairlist/pairlistmanager.py b/freqtrade/pairlist/pairlistmanager.py index 5c3a3aaa7..78a6a9668 100644 --- a/freqtrade/pairlist/pairlistmanager.py +++ b/freqtrade/pairlist/pairlistmanager.py @@ -3,22 +3,19 @@ PairList manager class """ import logging from copy import deepcopy -from typing import Dict, List, Tuple +from typing import Dict, List from cachetools import TTLCache, cached from freqtrade.exceptions import OperationalException from freqtrade.pairlist.IPairList import IPairList from freqtrade.resolvers import PairListResolver +from freqtrade.typing import ListPairsWithTimeframes logger = logging.getLogger(__name__) -# List of pairs with their timeframes -ListPairsWithTimeframes = List[Tuple[str, str]] - - class PairListManager(): def __init__(self, exchange, config: dict) -> None: diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index d5d171bec..8031c7932 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -15,9 +15,9 @@ from pandas import DataFrame from freqtrade.data.dataprovider import DataProvider from freqtrade.exceptions import StrategyError from freqtrade.exchange import timeframe_to_minutes -from freqtrade.pairlist.pairlistmanager import ListPairsWithTimeframes from freqtrade.persistence import Trade from freqtrade.strategy.strategy_wrapper import strategy_safe_wrapper +from freqtrade.typing import ListPairsWithTimeframes from freqtrade.wallets import Wallets diff --git a/freqtrade/typing.py b/freqtrade/typing.py new file mode 100644 index 000000000..3cb7cf816 --- /dev/null +++ b/freqtrade/typing.py @@ -0,0 +1,8 @@ +""" +Common Freqtrade types +""" + +from typing import List, Tuple + +# List of pairs with their timeframes +ListPairsWithTimeframes = List[Tuple[str, str]]