From fc5dc145b4c9d326dcf424fc42593af1de3c39e0 Mon Sep 17 00:00:00 2001 From: Camilo1704 Date: Wed, 18 Mar 2020 14:54:49 -0300 Subject: [PATCH] fixed sma calculation --- backtester/datahandler/tiingo_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backtester/datahandler/tiingo_data.py b/backtester/datahandler/tiingo_data.py index aaae994..0f35d6e 100644 --- a/backtester/datahandler/tiingo_data.py +++ b/backtester/datahandler/tiingo_data.py @@ -81,6 +81,6 @@ class TiingoData: def sma(self, periods): sma = self._data.groupby('symbol', as_index=False).rolling(periods)['adjClose'].mean() sma = sma.fillna(0) - sma.index = sma.index.levels[1] + sma.index = [index[1] for index in sma.index] self._data['sma'] = sma self.schema.update({'sma': 'sma'})