Alpha Vantage not working correctly

I am having some issues with the alpha_vantage integration

- platform: alpha_vantage
  api_key: <key_here>
  symbols:
  - symbol: AAPL
  - symbol: GPN
  - symbol: TSLA

It seems its having trouble showing more that 2 symbols. As soon I add a third symbol, it only shows the first and the last.

Anyone else experiencing this issue?
Any workarounds?
Thanks

The free API only allows effectively 1 symbol tracking. I only got one working.

Check in logs to see if there’s any messages telling you why it’s not working.

This happens because the free API key we can sign up for allows no more than five queries PER MINUTE.

That limit gets hit fast with more than 1-2 symbols. Some kind of built in delay would be super helpful.

I’m trying to get this to work too and running into problems and I’m only using a single symbol. Unless it’s normal to get a single value for the day (which seems dumb):

Alpha Vantage chart:
image

Yahoo chart:
image

This is my config:

sensor:
  - platform: alpha_vantage
    api_key: !secret alpha_vantage_api_key
    symbols:
      - symbol: MU

Seems like there might be something wrong with this component because I do see an error message in the logs but I can’t decipher it:

Log Details (ERROR)
Logger: homeassistant.helpers.entity
Source: components/alpha_vantage/sensor.py:154
First occurred: September 9, 2020, 11:03:13 AM (2 occurrences)
Last logged: September 9, 2020, 11:08:08 AM

Update for sensor.mu fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 263, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 456, in async_device_update
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/alpha_vantage/sensor.py", line 154, in update
    all_values, _ = self._timeseries.get_intraday(self._symbol)
  File "/usr/local/lib/python3.8/site-packages/alpha_vantage/alphavantage.py", line 218, in _format_wrapper
    call_response, data_key, meta_data_key = func(
  File "/usr/local/lib/python3.8/site-packages/alpha_vantage/alphavantage.py", line 160, in _call_wrapper
    return self._handle_api_call(url), data_key, meta_data_key
  File "/usr/local/lib/python3.8/site-packages/alpha_vantage/alphavantage.py", line 332, in _handle_api_call
    json_response = response.json()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

What gives?

If you try this in your web browser:

https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=IBM&apikey=XXXX

Make sure you place your own API key where it says “XXXX”

Do you get results? If so make sure your API key is accurate in your config. If it doesn’t work you need to check your API key in general as it would seem to be invalid.

I moved away from AV to this one GitHub - iprak/yahoofinance: Home Assistant component which allows you to get stock updates from Yahoo finance.

1 Like

I did this and it seems to give me a JSON structure (as I’d expect). However, I did it a few times within 10-20 minutes and it always gives the same values while the market was opened… is it supposed to return up-to-the-minute values? I assumed that it was supposed to but maybe it’s just for a single daily value (which seems dumb). I prefer yahoofinance anyway, it’s too bad that your suggestion isn’t part of HA or the HACS stuff.