From 9fa21628d7cf77fe81dca35373b9caa21c0c6515 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 25 Apr 2020 16:29:17 +0200 Subject: [PATCH] Deprecate keys other than quoteVolume fixes #2981 --- docs/configuration.md | 4 +--- docs/deprecated.md | 6 +++++- freqtrade/pairlist/VolumePairList.py | 4 ++++ tests/pairlist/test_pairlist.py | 13 ++++++++++--- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 338299781..2942014be 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -585,7 +585,7 @@ It uses configuration from `exchange.pair_whitelist` and `exchange.pair_blacklis #### Volume Pair List -`VolumePairList` selects `number_assets` top pairs based on `sort_key`, which can be one of `askVolume`, `bidVolume` and `quoteVolume` and defaults to `quoteVolume`. +`VolumePairList` selects `number_assets` top pairs based on `sort_key`, which can only be `quoteVolume`. `VolumePairList` considers outputs of previous pairlists unless it's the first configured pairlist, it does not consider `pair_whitelist`, but selects the top assets from all available markets (with matching stake-currency) on the exchange. @@ -593,8 +593,6 @@ It uses configuration from `exchange.pair_whitelist` and `exchange.pair_blacklis `VolumePairList` is based on the ticker data, as reported by the ccxt library: -* The `bidVolume` is the volume (amount) of current best bid in the orderbook. -* The `askVolume` is the volume (amount) of current best ask in the orderbook. * The `quoteVolume` is the amount of quote (stake) currency traded (bought or sold) in last 24 hours. ```json diff --git a/docs/deprecated.md b/docs/deprecated.md index a9a914f44..408c7b2ac 100644 --- a/docs/deprecated.md +++ b/docs/deprecated.md @@ -27,6 +27,10 @@ Removed in 2019-7-dev (develop branch) and in freqtrade 2019-8 (master branch) ### Allow running multiple pairlists in sequence -The former `"pairlists"` section in the configuration has been removed, and is replaced by `pairlist` - being a list to specify a sequence of pairlists. +The former `"pairlist"` section in the configuration has been removed, and is replaced by `pairlists` - being a list to specify a sequence of pairlists. The old option has been deprecated in 2019.11 and has been removed in 2020.4. + +### deprecation of bidVolume and askVolume from volumepairlist + +Since only quoteVolume can be compared between assets, the other options (bidVolume, askVolume) have been deprecated in 2020.4. diff --git a/freqtrade/pairlist/VolumePairList.py b/freqtrade/pairlist/VolumePairList.py index 65f43245c..eb44fe725 100644 --- a/freqtrade/pairlist/VolumePairList.py +++ b/freqtrade/pairlist/VolumePairList.py @@ -39,6 +39,10 @@ class VolumePairList(IPairList): if not self._validate_keys(self._sort_key): raise OperationalException( f'key {self._sort_key} not in {SORT_VALUES}') + if self._sort_key != 'quoteVolume': + logger.warning( + "DEPRECATED: using any key other than quoteVolume for VolumePairList is deprecated." + ) @property def needstickers(self) -> bool: diff --git a/tests/pairlist/test_pairlist.py b/tests/pairlist/test_pairlist.py index 7dfe8bcca..f9e2893c3 100644 --- a/tests/pairlist/test_pairlist.py +++ b/tests/pairlist/test_pairlist.py @@ -4,11 +4,11 @@ from unittest.mock import MagicMock, PropertyMock import pytest -from freqtrade.exceptions import OperationalException from freqtrade.constants import AVAILABLE_PAIRLISTS -from freqtrade.resolvers import PairListResolver +from freqtrade.exceptions import OperationalException from freqtrade.pairlist.pairlistmanager import PairListManager -from tests.conftest import get_patched_freqtradebot, log_has_re +from freqtrade.resolvers import PairListResolver +from tests.conftest import get_patched_freqtradebot, log_has, log_has_re # whitelist, blacklist @@ -228,6 +228,13 @@ def test_VolumePairList_whitelist_gen(mocker, whitelist_conf, shitcoinmarkets, t assert (log_has_re(r'^Removed .* from whitelist, because 1 unit is .*%$', caplog) or log_has_re(r"^Removed .* from whitelist, because ticker\['last'\] is empty.*", caplog)) + if pairlist['method'] == 'VolumePairList': + logmsg = ("DEPRECATED: using any key other than quoteVolume for " + "VolumePairList is deprecated.") + if pairlist['sort_key'] != 'quoteVolume': + assert log_has(logmsg, caplog) + else: + assert not log_has(logmsg, caplog) def test_gen_pair_whitelist_not_supported(mocker, default_conf, tickers) -> None: