Alpha_vantage produces an error. Any ideas?
from alpha_vantage.timeseries import TimeSeries
import pandas as pd
print('Pandas_Version: ' + pd.__version__)
symbol = 'GOOGL'
ts = TimeSeries(key='4BTFICZGTPWZRRQS', output_format='pandas')
close = ts.get_daily(symbol=symbol, outputsize='full')[0]['close']
direction = (close > close.shift()).astype(int)
target = direction.shift(-1).fillna(0).astype(int)
target.name = 'target'
produces error:
Pandas_Version: 0.23.0 Traceback (most recent call last):
File "", line 1, in runfile('F:/Eigene Dokumente_C/Documents/AI/Deep_Learning/test_stock_predictor.py', wdir='F:/Eigene Dokumente_C/Documents/AI/Deep_Learning')
File "C:\Users\Ackermann\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)
File "C:\Users\Ackermann\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "F:/Eigene Dokumente_C/Documents/AI/Deep_Learning/test_stock_predictor.py", line 16, in close = ts.get_daily(symbol=symbol, outputsize='full')[0]['close'] # compact/full
File "C:\Users\Ackermann\Anaconda3\lib\site-packages\pandas\core\frame.py", line 2685, in getitem return self._getitem_column(key)
File "C:\Users\Ackermann\Anaconda3\lib\site-packages\pandas\core\frame.py", line 2692, in _getitem_column return self._get_item_cache(key)
File "C:\Users\Ackermann\Anaconda3\lib\site-packages\pandas\core\generic.py", line 2486, in _get_item_cache values = self._data.get(item)
File "C:\Users\Ackermann\Anaconda3\lib\site-packages\pandas\core\internals.py", line 4115, in get loc = self.items.get_loc(item)
File "C:\Users\Ackermann\Anaconda3\lib\site-packages\pandas\core\indexes\base.py", line 3065, in get_loc return self._engine.get_loc(self._maybe_cast_indexer(key))
File "pandas_libs\index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libs\index.pyx", line 162, in pandas._libs.index.IndexEngine.get_loc
File "pandas_libs\hashtable_class_helper.pxi", line 1492, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas_libs\hashtable_class_helper.pxi", line 1500, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'close'