Alpha Vantage randomly says Invalid API Call

为君一笑 提交于 2020-06-29 03:18:56

问题


I have code in python that periodically fetches data for a particular ticker.

import pandas as pd
import time
def intraday(ticker, interval, key):
    """
    Returns interday data
    """
    url = f'https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol={ticker}&interval={interval}&apikey={key}&datatype=csv'
    df = pd.read_csv(url)
    df = df.reset_index()

while True:
    print(intraday('AAPL', '1min', key)
    time.sleep(60)

The problem that I face, is that this code works well most of the time. However, occasionally, it throws an error, saying "Invalid API call".

This doesn't happen all the time. Maybe once is 3-4 calls. Sometimes at in the first call.

I'm in no way modifying anything else as well

What's going on?


回答1:


Yes same issue here, but do not fear, it doesn't seem to be an issue with your code. The api response seems down across the board. Even their demo requests aren't working e.g https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=IBM&interval=5min&apikey=demo from https://www.alphavantage.co/documentation/

Hopefully it will be fixed soon!



来源:https://stackoverflow.com/questions/62571702/alpha-vantage-randomly-says-invalid-api-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!