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:
parent
1e87225e91
commit
3c3772703b
@ -183,8 +183,15 @@ class VolumePairList(IPairList):
|
|||||||
pair_candles['volume'] * pair_candles['typical_price']
|
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
|
# replace quoteVolume with range quoteVolume sum calculated above
|
||||||
filtered_tickers[i]['quoteVolume'] = pair_candles['quoteVolume'].sum()
|
filtered_tickers[i]['quoteVolume'] = quoteVolume
|
||||||
else:
|
else:
|
||||||
filtered_tickers[i]['quoteVolume'] = 0
|
filtered_tickers[i]['quoteVolume'] = 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user