core: Multiple Stocks fail with alpha_vantage component
Home Assistant release with the issue: 0.90.1
Last working Home Assistant release (if known): unknown
Operating environment (Hass.io/Docker/Windows/etc.): hassio running on Raspberry Pi
Component/platform: alpha_vantage
Description of problem: Several issues have been opened regarding the KeyError: ‘Time Series (15min)’, startup error and api limit. I read that we could get a premium API key; however, those cost a minimum of $30 USD per month up to $250 USD per month!! There really needs to be some way to do a circular queue “round-robin” of the stocks in the API call to not exceed the value. I think that most of us are not using these stock prices as a real-time indicator to buy/sell stock… we simply want to have a convenient place to see our stock prices.
Problem-relevant configuration.yaml
entries and (fill out even if it seems unimportant):
---
platform: alpha_vantage
api_key: !secret alpha_vantage_key
symbols:
- name: Sprint
currency: USD
symbol: S
- name: Apple
currency: USD
symbol: AAPL
- name: Google
currency: USD
symbol: GOOGL
Traceback (if applicable):
Tue Mar 26 2019 09:50:56 GMT-0500 (CDT)
alpha_vantage: Error on device update!
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 379, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/sensor/alpha_vantage.py", line 161, in update
all_values, _ = self._timeseries.get_intraday(self._symbol)
File "/usr/local/lib/python3.7/site-packages/alpha_vantage/alphavantage.py", line 178, in _format_wrapper
data = call_response[data_key]
KeyError: 'Time Series (15min)'
Additional information: Issues #15271 offered a solution to get multiple stocks at the same time thus reducing the number of API calls which would also help this situation.
Without implementing something to regulate the API calls, anyone with more than one stock to monitor cannot use this component.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 19 (6 by maintainers)
I wish I could figure out how to update this code, but I’m a noob with python. Issue has been open since March.
Not yet. Thanks for the feedback. I’ll look at this further over the weekend, I’ve been out of town.
Thanks, @rohankapoorcom! I can’t try that until Wednesday due to my schedule. I’ll let you know what I find.
I’m going to take a look and see what I can do to pull the data update out to a single call.