diff --git a/docs/includes/pairlists.md b/docs/includes/pairlists.md index f19c5a181..3f8baab29 100644 --- a/docs/includes/pairlists.md +++ b/docs/includes/pairlists.md @@ -63,7 +63,7 @@ The `refresh_period` setting allows to define the period (in seconds), at which The pairlist cache (`refresh_period`) on `VolumePairList` is only applicable to generating pairlists. Filtering instances (not the first position in the list) will not apply any cache and will always use up-to-date data. -`VolumePairList` is based on the ticker data from exchange, as reported by the ccxt library: +`VolumePairList` is per default based on the ticker data from exchange, as reported by the ccxt library: * The `quoteVolume` is the amount of quote (stake) currency traded (bought or sold) in last 24 hours. @@ -76,6 +76,35 @@ Filtering instances (not the first position in the list) will not apply any cach }], ``` +`VolumePairList` can also operate in an advanced mode to build volume over a given timerange of specified candle size. It utilizes exchange historical candle data, builds a typical price (calculated by (open+high+low)/3), and multiplies it with every candle data's volume. The sum is the `quoteVolume` over the given range. This allows different scenarios, for a more smoothened volume, when using longer ranges with larger candle sizes, or the opposite when using a short range with small candles. + +For convenience `lookback_days` can be specified, which will imply that 1d candles will be used for the lookback. In the example below the pairlist would be created based on the last 7 days: + +```json +"pairlists": [{ + "method": "VolumePairList", + "number_assets": 20, + "sort_key": "quoteVolume", + "refresh_period": 86400, + "lookback_days": 7 +}], +``` +!!! Warning "Range look back and refresh period" + When used in conjuction with `lookback_days` and `lookback_timeframe` the `refresh_period` can not be smaller than the candle size in seconds. As this will result in unnecessary requests to the exchanges API. + +More sophisticated approach can be used, by using `lookback_timeframe` for candle size and `lookback_period` which specifies the amount of candles. This example will build the volume pairs based on a rolling period of 3 days of 1h candles: + +```json +"pairlists": [{ + "method": "VolumePairList", + "number_assets": 20, + "sort_key": "quoteVolume", + "refresh_period": 3600, + "lookback_timeframe": "1h", + "lookback_timeframe": 72 +}], +``` + !!! Note `VolumePairList` does not support backtesting mode. diff --git a/freqtrade/plugins/pairlist/VolumePairList.py b/freqtrade/plugins/pairlist/VolumePairList.py index 40e6afa07..352d028ac 100644 --- a/freqtrade/plugins/pairlist/VolumePairList.py +++ b/freqtrade/plugins/pairlist/VolumePairList.py @@ -147,12 +147,12 @@ class VolumePairList(IPairList): .floor('minute') .shift(minutes=-(self._lookback_period * self._tf_in_min) - self._tf_in_min) - .float_timestamp) * 1000 + .int_timestamp) * 1000 to_ms = int(arrow.utcnow() .floor('minute') .shift(minutes=-self._tf_in_min) - .float_timestamp) * 1000 + .int_timestamp) * 1000 # todo: utc date output for starting date self.log_once(f"Using volume range of {self._lookback_period} candles, timeframe: "