Not sure why I am getting invalid API call for the following code but when i change ticker to an actual ticker then the code works. Can anyone advise?
import pandas as pd
from alpha_vantage.timeseries import TimeSeries
import datetime as dt
import time
all_tickers = ['MSFT', 'CSCO', 'AMZN', 'FB', 'GOOG']
close_prices = pd.DataFrame()
api_call = 0
for ticker in all_tickers:
starttime=time.time()
ts = TimeSeries(key="1234567890", output_format="pandas")
api_call +=1
data = ts.get_intraday(symbol=ticker, interval='1min', outputsize='compact')[0]
data.columns = ['open', 'high', 'low', 'close', 'volume']
close_prices[ticker] = data['close']
if api_call == 5:
api_call = 0
time.sleep (60 - (time.time() - starttime))