changed quoteVolume to be built over a

rolling period using lookback_period
to avoid pair_candles being larger
than requested lookback_period
This commit is contained in:
nightshift2k 2021-07-07 09:46:05 +02:00
parent 1e87225e91
commit 3c3772703b

View File

@ -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