Move pairlist validation to exchange (we need to use .quote) from
markets
This commit is contained in:
@@ -150,15 +150,3 @@ def _validate_whitelist(conf: Dict[str, Any]) -> None:
|
||||
if (pl.get('method') == 'StaticPairList'
|
||||
and not conf.get('exchange', {}).get('pair_whitelist')):
|
||||
raise OperationalException("StaticPairList requires pair_whitelist to be set.")
|
||||
|
||||
if pl.get('method') == 'StaticPairList':
|
||||
stake = conf['stake_currency']
|
||||
invalid_pairs = []
|
||||
for pair in conf['exchange'].get('pair_whitelist'):
|
||||
if not pair.endswith(f'/{stake}'):
|
||||
invalid_pairs.append(pair)
|
||||
|
||||
if invalid_pairs:
|
||||
raise OperationalException(
|
||||
f"Stake-currency '{stake}' not compatible with pair-whitelist. "
|
||||
f"Please remove the following pairs: {invalid_pairs}")
|
||||
|
@@ -300,7 +300,7 @@ class Exchange:
|
||||
if not self.markets:
|
||||
logger.warning('Unable to validate pairs (assuming they are correct).')
|
||||
return
|
||||
|
||||
invalid_pairs = []
|
||||
for pair in pairs:
|
||||
# Note: ccxt has BaseCurrency/QuoteCurrency format for pairs
|
||||
# TODO: add a support for having coins in BTC/USDT format
|
||||
@@ -322,6 +322,12 @@ class Exchange:
|
||||
logger.warning(f"Pair {pair} is restricted for some users on this exchange."
|
||||
f"Please check if you are impacted by this restriction "
|
||||
f"on the exchange and eventually remove {pair} from your whitelist.")
|
||||
if not self.markets[pair].get('quote') == self._config['stake_currency']:
|
||||
invalid_pairs.append(pair)
|
||||
if invalid_pairs:
|
||||
raise OperationalException(
|
||||
f"Stake-currency '{self._config['stake_currency']}' not compatible with "
|
||||
f"pair-whitelist. Please remove the following pairs: {invalid_pairs}")
|
||||
|
||||
def get_valid_pair_combination(self, curr_1: str, curr_2: str) -> str:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user