Verify blacklist correctly
This commit is contained in:
parent
eaf3fd80c5
commit
31c7189b8b
@ -57,14 +57,22 @@ class IPairList(ABC):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _verify_blacklist(self, pairlist: List[str]) -> List[str]:
|
def verify_blacklist(self, pairlist: List[str], blacklist: List[str]) -> List[str]:
|
||||||
|
"""
|
||||||
|
Verify and remove items from pairlist - returning a filtered pairlist.
|
||||||
|
"""
|
||||||
for pair in deepcopy(pairlist):
|
for pair in deepcopy(pairlist):
|
||||||
if pair in self._pairlistmanager.blacklist:
|
if pair in blacklist:
|
||||||
logger.warning(f"Pair {pair} in your blacklist. Removing it from whitelist...")
|
logger.warning(f"Pair {pair} in your blacklist. Removing it from whitelist...")
|
||||||
pairlist.remove(pair)
|
pairlist.remove(pair)
|
||||||
return pairlist
|
return pairlist
|
||||||
|
|
||||||
|
def _verify_blacklist(self, pairlist: List[str]) -> List[str]:
|
||||||
|
"""
|
||||||
|
Proxy method to verify_blacklist for easy access for child classes.
|
||||||
|
"""
|
||||||
|
return IPairList.verify_blacklist(pairlist, self._pairlistmanager.blacklist)
|
||||||
|
|
||||||
def _whitelist_for_active_markets(self, whitelist: List[str]) -> List[str]:
|
def _whitelist_for_active_markets(self, whitelist: List[str]) -> List[str]:
|
||||||
"""
|
"""
|
||||||
Check available markets and remove pair from whitelist if necessary
|
Check available markets and remove pair from whitelist if necessary
|
||||||
|
@ -61,5 +61,6 @@ class PairListManager():
|
|||||||
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 = self.verify_blacklist(pairlist, self.blacklist)
|
pairlist = IPairList.verify_blacklist(pairlist, self.blacklist)
|
||||||
|
|
||||||
self._whitelist = pairlist
|
self._whitelist = pairlist
|
||||||
|
Loading…
Reference in New Issue
Block a user