Merge pull request #2625 from freqtrade/validate_stakecurrency
Validate stake-currency against pairlist
This commit is contained in:
commit
a7d6dc9d3a
@ -131,3 +131,15 @@ 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}")
|
||||
|
@ -798,6 +798,12 @@ def test_validate_whitelist(default_conf):
|
||||
|
||||
validate_config_consistency(conf)
|
||||
|
||||
conf = deepcopy(default_conf)
|
||||
conf['stake_currency'] = 'USDT'
|
||||
with pytest.raises(OperationalException,
|
||||
match=r"Stake-currency 'USDT' not compatible with pair-whitelist.*"):
|
||||
validate_config_consistency(conf)
|
||||
|
||||
|
||||
def test_load_config_test_comments() -> None:
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user