Move _create_pair_whitelist to dataprovider

This commit is contained in:
hroff-1902
2020-05-16 11:25:32 +03:00
parent bf25746965
commit 035a12ce61
2 changed files with 10 additions and 9 deletions

View File

@@ -25,6 +25,7 @@ class DataProvider:
self._config = config
self._exchange = exchange
self._pairlists = pairlists
self._timeframe = self._config['ticker_interval']
def refresh(self,
pairlist: ListPairsWithTimeframes,
@@ -45,6 +46,12 @@ 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._timeframe) 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
@@ -55,7 +62,7 @@ class DataProvider:
Use False only for read-only operations (where the dataframe is not modified)
"""
if self.runmode in (RunMode.DRY_RUN, RunMode.LIVE):
return self._exchange.klines((pair, timeframe or self._config['ticker_interval']),
return self._exchange.klines((pair, timeframe or self._timeframe),
copy=copy)
else:
return DataFrame()
@@ -67,7 +74,7 @@ class DataProvider:
:param timeframe: timeframe to get data for
"""
return load_pair_history(pair=pair,
timeframe=timeframe or self._config['ticker_interval'],
timeframe=timeframe or self._timeframe,
datadir=self._config['datadir']
)