Allow chaining of pairlists

This commit is contained in:
Matthias
2019-11-09 06:55:16 +01:00
parent dee9b84322
commit e632720c02
10 changed files with 143 additions and 165 deletions

View File

@@ -5,6 +5,7 @@ Provides lists as configured in config.json
"""
import logging
from typing import List, Dict
from freqtrade.pairlist.IPairList import IPairList
@@ -13,8 +14,8 @@ logger = logging.getLogger(__name__)
class StaticPairList(IPairList):
def __init__(self, freqtrade, config: dict) -> None:
super().__init__(freqtrade, config)
def __init__(self, exchange, config, pairlistconfig: dict) -> None:
super().__init__(exchange, config, pairlistconfig)
def short_desc(self) -> str:
"""
@@ -23,8 +24,12 @@ class StaticPairList(IPairList):
"""
return f"{self.name}: {self.whitelist}"
def refresh_pairlist(self) -> None:
def filter_pairlist(self, pairlist: List[str], tickers: List[Dict]) -> List[str]:
"""
Refreshes pairlists and assigns them to self._whitelist and self._blacklist respectively
Filters and sorts pairlist and returns the whitelist again.
Called on each bot iteration - please use internal caching if necessary
:param pairlist: pairlist to filter or sort
:param tickers: Tickers (from exchange.get_tickers()). May be cached.
:return: new whitelist
"""
self._whitelist = self.validate_whitelist(self._config['exchange']['pair_whitelist'])
return self.validate_whitelist(self._config['exchange']['pair_whitelist'])