diff --git a/docs/developer.md b/docs/developer.md index c564acffb..9137f16ca 100644 --- a/docs/developer.md +++ b/docs/developer.md @@ -43,7 +43,7 @@ Additional elements can be configured as needed. `VolumePairList` uses `"sort_ke #### short_desc Returns a description used for Telegram messages. -This should coutain the name of the Provider, as well as a short description containing the number of assets. Please follow the format `"PairlistName - top/bottom X pairs"`. +This should contain the name of the Provider, as well as a short description containing the number of assets. Please follow the format `"PairlistName - top/bottom X pairs"`. #### refresh_pairlist diff --git a/freqtrade/pairlist/VolumePairList.py b/freqtrade/pairlist/VolumePairList.py index 9d3d46169..262e4bf59 100644 --- a/freqtrade/pairlist/VolumePairList.py +++ b/freqtrade/pairlist/VolumePairList.py @@ -20,6 +20,10 @@ class VolumePairList(IPairList): def __init__(self, freqtrade, config: dict) -> None: super().__init__(freqtrade, config) self._whitelistconf = self._config.get('pairlist', {}).get('config') + if 'number_assets' not in self._whitelistconf: + raise OperationalException( + f'`number_assets` not specified. Please check your configuration ' + 'for "pairlist.config.number_assets"') self._number_pairs = self._whitelistconf['number_assets'] self._sort_key = self._whitelistconf.get('sort_key', 'quoteVolume') diff --git a/freqtrade/tests/pairlist/test_pairlist.py b/freqtrade/tests/pairlist/test_pairlist.py index 83c3817a7..9f90aac6e 100644 --- a/freqtrade/tests/pairlist/test_pairlist.py +++ b/freqtrade/tests/pairlist/test_pairlist.py @@ -85,6 +85,14 @@ def test_refresh_pairlist_dynamic(mocker, markets, tickers, whitelist_conf): assert whitelist == freqtradebot.pairlists.whitelist + whitelist_conf['pairlist'] = {'method': 'VolumePairList', + 'config': {} + } + with pytest.raises(OperationalException, + match=r'`number_assets` not specified. Please check your configuration ' + r'for "pairlist.config.number_assets"'): + PairListResolver('VolumePairList', freqtradebot, whitelist_conf).pairlist + def test_VolumePairList_refresh_empty(mocker, markets_empty, whitelist_conf): freqtradebot = get_patched_freqtradebot(mocker, whitelist_conf)