Move _create_pair_whitelist to dataprovider
This commit is contained in:
parent
bf25746965
commit
035a12ce61
@ -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']
|
||||
)
|
||||
|
||||
|
@ -145,7 +145,7 @@ class FreqtradeBot:
|
||||
self.active_pair_whitelist = self._refresh_whitelist(trades)
|
||||
|
||||
# Refreshing candles
|
||||
self.dataprovider.refresh(self._create_pair_whitelist(self.active_pair_whitelist),
|
||||
self.dataprovider.refresh(self.dataprovider.create_pair_list(self.active_pair_whitelist),
|
||||
self.strategy.informative_pairs())
|
||||
|
||||
with self._sell_lock:
|
||||
@ -184,12 +184,6 @@ class FreqtradeBot:
|
||||
_whitelist.extend([trade.pair for trade in trades if trade.pair not in _whitelist])
|
||||
return _whitelist
|
||||
|
||||
def _create_pair_whitelist(self, pairs: List[str]) -> List[Tuple[str, str]]:
|
||||
"""
|
||||
Create pair-whitelist tuple with (pair, ticker_interval)
|
||||
"""
|
||||
return [(pair, self.config['ticker_interval']) for pair in pairs]
|
||||
|
||||
def get_free_open_trades(self):
|
||||
"""
|
||||
Return the number of free open trades slots or 0 if
|
||||
|
Loading…
Reference in New Issue
Block a user