From 3c3772703bdc8897abcf03c5c4ee6bf45c27e802 Mon Sep 17 00:00:00 2001 From: nightshift2k Date: Wed, 7 Jul 2021 09:46:05 +0200 Subject: [PATCH] changed quoteVolume to be built over a rolling period using lookback_period to avoid pair_candles being larger than requested lookback_period --- freqtrade/plugins/pairlist/VolumePairList.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/freqtrade/plugins/pairlist/VolumePairList.py b/freqtrade/plugins/pairlist/VolumePairList.py index 14b9d7024..d6b8aaaa3 100644 --- a/freqtrade/plugins/pairlist/VolumePairList.py +++ b/freqtrade/plugins/pairlist/VolumePairList.py @@ -183,8 +183,15 @@ class VolumePairList(IPairList): pair_candles['volume'] * pair_candles['typical_price'] ) + # ensure that a rolling sum over the lookback_period is built + # if pair_candles contains more candles than lookback_period + quoteVolume = (pair_candles['quoteVolume'] + .rolling(self._lookback_period) + .sum() + .iloc[-1]) + # replace quoteVolume with range quoteVolume sum calculated above - filtered_tickers[i]['quoteVolume'] = pair_candles['quoteVolume'].sum() + filtered_tickers[i]['quoteVolume'] = quoteVolume else: filtered_tickers[i]['quoteVolume'] = 0