Better handling of shift

This commit is contained in:
Matthias 2023-05-28 09:59:57 +02:00
parent 4eb4275331
commit a3473f3f60

View File

@ -103,7 +103,7 @@ class VolatilityFilter(IPairList):
result = False
if daily_candles is not None and not daily_candles.empty:
returns = (np.log(daily_candles.close / daily_candles.close.shift(-1)))
returns = (np.log(daily_candles["close"].shift(1) / daily_candles["close"]))
returns.fillna(0, inplace=True)
volatility_series = returns.rolling(window=self._days).std() * np.sqrt(self._days)