Better handling of shift

This commit is contained in:
Matthias
2023-05-28 09:59:57 +02:00
parent 8ec0469b11
commit 8a86169256

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)