Search code examples
alpha-vantage

What does ```treat_info_as_error``` do in Alpha Vantage python module


For the alpha-vantage python module, does anyone know what the argument treat_info_as_error does?

This is what I found in terms of documentation. It's not much.

TimeSeries Definition : TimeSeries(key=None, output_format='json', treat_info_as_error=True, indexing_type='date', >proxy=None)

This class implements all the api calls to times series


Solution

  • When you run an almost invalid API call on Alpha Vantage you'll get a key in the JSON response that says "note" or "Information" or something like that. This parameter is whether or not you want to treat those in your code as an error.

    For some reference, here is a link to the docs.

    For example, if you hit an API call threshold, or use the "demo" API key for calls other than what they are suited for.

    Try this API call: https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=TSLA&interval=5min&apikey=demo

    You'll see it says "Information" as the first key.