Move create_pair_list to pairlistmanager

This commit is contained in:
hroff-1902 2020-05-18 13:54:21 +03:00
parent 5f2a871637
commit 627c5059f0
6 changed files with 16 additions and 18 deletions

View File

@ -1,7 +0,0 @@
"""
Common datatypes
"""
from typing import List, Tuple
# List of pairs with their timeframes
ListPairsWithTimeframes = List[Tuple[str, str]]

View File

@ -9,10 +9,10 @@ from typing import Any, Dict, List, Optional
from pandas import DataFrame
from freqtrade.data.common import ListPairsWithTimeframes
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
@ -45,12 +45,6 @@ class DataProvider:
"""
return list(self._exchange._klines.keys())
def create_pair_list(self, pairs: List[str], timeframe: str = None) -> ListPairsWithTimeframes:
"""
Create list of pair tuples with (pair, ticker_interval)
"""
return [(pair, timeframe or self._config['ticker_interval']) for pair in pairs]
def ohlcv(self, pair: str, timeframe: str = None, copy: bool = True) -> DataFrame:
"""
Get candle (OHLCV) data for the given pair as DataFrame

View File

@ -18,12 +18,12 @@ from ccxt.base.decimal_to_precision import (ROUND_DOWN, ROUND_UP, TICK_SIZE,
TRUNCATE, decimal_to_precision)
from pandas import DataFrame
from freqtrade.data.common import ListPairsWithTimeframes
from freqtrade.data.converter import ohlcv_to_dataframe, trades_dict_to_list
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
CcxtModuleType = Any

View File

@ -145,7 +145,7 @@ class FreqtradeBot:
self.active_pair_whitelist = self._refresh_active_whitelist(trades)
# Refreshing candles
self.dataprovider.refresh(self.dataprovider.create_pair_list(self.active_pair_whitelist),
self.dataprovider.refresh(self.pairlists.create_pair_list(self.active_pair_whitelist),
self.strategy.informative_pairs())
with self._sell_lock:

View File

@ -5,7 +5,7 @@ Provides lists as configured in config.json
"""
import logging
from typing import Dict, List
from typing import Dict, List, Tuple
from cachetools import TTLCache, cached
@ -13,9 +13,14 @@ from freqtrade.exceptions import OperationalException
from freqtrade.pairlist.IPairList import IPairList
from freqtrade.resolvers import PairListResolver
logger = logging.getLogger(__name__)
# List of pairs with their timeframes
ListPairsWithTimeframes = List[Tuple[str, str]]
class PairListManager():
def __init__(self, exchange, config: dict) -> None:
@ -94,3 +99,9 @@ class PairListManager():
pairlist = IPairList.verify_blacklist(pairlist, self.blacklist, True)
self._whitelist = pairlist
def create_pair_list(self, pairs: List[str], timeframe: str = None) -> ListPairsWithTimeframes:
"""
Create list of pair tuples with (pair, ticker_interval)
"""
return [(pair, timeframe or self._config['ticker_interval']) for pair in pairs]

View File

@ -12,10 +12,10 @@ from typing import Dict, NamedTuple, Optional, Tuple
import arrow
from pandas import DataFrame
from freqtrade.data.common import ListPairsWithTimeframes
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.wallets import Wallets