Cleanup pairlistmanager
This commit is contained in:
parent
ce185a3b19
commit
97c50f86e9
@ -1,8 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
Static List provider
|
PairList manager class
|
||||||
|
|
||||||
Provides lists as configured in config.json
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
@ -14,6 +11,7 @@ from freqtrade.exceptions import OperationalException
|
|||||||
from freqtrade.pairlist.IPairList import IPairList
|
from freqtrade.pairlist.IPairList import IPairList
|
||||||
from freqtrade.resolvers import PairListResolver
|
from freqtrade.resolvers import PairListResolver
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -79,8 +77,7 @@ class PairListManager():
|
|||||||
"""
|
"""
|
||||||
Run pairlist through all configured pairlists.
|
Run pairlist through all configured pairlists.
|
||||||
"""
|
"""
|
||||||
|
# Tickers should be cached to avoid calling the exchange on each call.
|
||||||
# tickers should be cached to avoid calling the exchange on each call.
|
|
||||||
tickers: Dict = {}
|
tickers: Dict = {}
|
||||||
if self._tickers_needed:
|
if self._tickers_needed:
|
||||||
tickers = self._get_cached_tickers()
|
tickers = self._get_cached_tickers()
|
||||||
@ -92,21 +89,21 @@ class PairListManager():
|
|||||||
for pl in self._pairlists:
|
for pl in self._pairlists:
|
||||||
pairlist = pl.filter_pairlist(pairlist, tickers)
|
pairlist = pl.filter_pairlist(pairlist, tickers)
|
||||||
|
|
||||||
# Validation against blacklist happens after the pairlists to ensure blacklist is respected.
|
# Validation against blacklist happens after the pairlists to ensure
|
||||||
|
# blacklist is respected.
|
||||||
pairlist = IPairList.verify_blacklist(pairlist, self.blacklist, True)
|
pairlist = IPairList.verify_blacklist(pairlist, self.blacklist, True)
|
||||||
|
|
||||||
self._whitelist = pairlist
|
self._whitelist = pairlist
|
||||||
|
|
||||||
def _prepare_whitelist(self, pairlist: List[str], tickers) -> List[str]:
|
def _prepare_whitelist(self, pairlist: List[str], tickers) -> List[str]:
|
||||||
"""
|
"""
|
||||||
Prepare pairlist for Pairlist Filters that use tickers data - remove
|
Prepare sanitized pairlist for Pairlist Filters that use tickers data - remove
|
||||||
pairs that do not have ticker available
|
pairs that do not have ticker available
|
||||||
"""
|
"""
|
||||||
if self._tickers_needed:
|
if self._tickers_needed:
|
||||||
# Copy list since we're modifying this list
|
# Copy list since we're modifying this list
|
||||||
for p in deepcopy(pairlist):
|
for p in deepcopy(pairlist):
|
||||||
ticker = tickers.get(p)
|
if p not in tickers:
|
||||||
if not ticker:
|
|
||||||
pairlist.remove(p)
|
pairlist.remove(p)
|
||||||
|
|
||||||
return pairlist
|
return pairlist
|
||||||
|
Loading…
Reference in New Issue
Block a user