Experiencing problem with all the currency exchange platforms lately

Hi,

Which platform do you use for currency and stock exchange rates? Am I the only one experiencing issue with all of them? I am interested in USD to EUR, HUF, BTC, ETH, XRP and a few stocks. So far what I am experiencing:

Currently only the Alpha Vantage could provide both currency, crypto and stock information. My implementation is like below but the problem is it is only providing information for one currency, kind of randomly. After every restart it picks one which works e.g. I have XRP information at the moment but the rest just causing an error in the log. After a restart I have e.g. BTC and all the others have the following error. Is anyone experiencing this? Anything to try?

Implementation:

- platform: alpha_vantage
  api_key: !secret alpha_vantage_api
  foreign_exchange:
    - name: USD_HUF
      from: USD
      to: HUF
    - name: Bitcoin
      from: BTC
      to: USD
    - name: Ethereum
      from: ETH
      to: USD
    - name: Ripple
      from: XRP
      to: USD

Error log:

2018-12-05 17:02:56 ERROR (MainThread) [homeassistant.components.sensor] alpha_vantage: Error on device update!
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 248, in _async_add_entity
await entity.async_device_update(warning=False)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/sensor/alpha_vantage.py”, line 216, in update
from_currency=self._from_currency, to_currency=self._to_currency)
File “/srv/homeassistant/lib/python3.6/site-packages/alpha_vantage/alphavantage.py”, line 178, in _format_wrapper
data = call_response[data_key]
KeyError: ‘Realtime Currency Exchange Rate’

CurrencyLayer

I just implemented, does not show any error but does not show up in the states list either. Basically it acts like it would not be in my implementation.

  - platform: currencylayer
    api_key: secret! currencylayer_api_key
    base: USD
    quote:
      - EUR
      - HUF

Coinmarketcap

Only showed me BTC as many times as many currencies I requested. I was requesting ETH, BTC, XRP and got bitcoin 3 times in the states list.

Fixer
I just removed, did not work either.

Any idea what and how to use would be highly appreciated!

Does anyone else using currency monitoring? Is any component working for you guys? Thanks!

I’m having the same problems with Alpha Vantage. Has never worked correctly for me, just fills logs with errors. Sorry, not help for you either…

I can confirm as well. Only the first currency is working. Anybody found a solution?

Thanks!

I could not find a stable, reliable solution yet.

Hi, I am a bit late…Just wanted to say that I am using cryptocompare API instead, which is quite reliable for cryptos. As there is no component to this date, I directly use the restful sensor. Here is an example

# BTC/USD
- platform: rest
  resource: https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD
  authentication: basic
  name: btc_usd
  value_template: '{{ value_json.USD }}'
  headers:
    authorization: Apikey !secret cryptocompare_key
    Content-Type: application/json
    User-Agent: Home Assistant REST sensor
  scan_interval: 300

You just need to generate an API key and save it in your secrets file.

I might look into building an actual component at some point in the future if I find some time…

2 Likes

Note that you can request multiple values in a single api call to spare your API rate limit. For instance, here is the config to get MIOTA and BTC exchange rates in USD, EUR and BTC.
Then I split the API response in separate sensors to use them in the frontend. But if you only want the exchange rates to manipulate in other templates it is not needed and you can directly use the restful one.

# Polls cryptocomare API to get exhange rate of MIOTA and BTC in USD, EUR and BTC
    
- platform: rest
  name: cryptocompare_sensors
  resource: https://min-api.cryptocompare.com/data/pricemulti?fsyms=BTC,MIOTA&tsyms=USD,EUR,BTC
  json_attributes:
    - MIOTA
    - BTC
  value_template: 'OK'  
  headers:
    authorization: Apikey !secret cryptocompare_key
    Content-Type: application/json
    User-Agent: Home Assistant REST sensor
  scan_interval: 300
- platform: template
  sensors:
    iota_eur:
      value_template: '{{ states.sensor.cryptocompare_sensors.attributes["MIOTA"]["EUR"] }}'
      unit_of_measurement: 'EUR'
    iota_usd:
      value_template: '{{ states.sensor.cryptocompare_sensors.attributes["MIOTA"]["USD"] }}'
      unit_of_measurement: 'USD'
    iota_btc:
      value_template: '{{ states.sensor.cryptocompare_sensors.attributes["MIOTA"]["BTC"] }}'
      unit_of_measurement: 'BTC'
    btc_eur:
      value_template: '{{ states.sensor.cryptocompare_sensors.attributes["BTC"]["EUR"] }}'
      unit_of_measurement: 'EUR'
    btc_usd:
      value_template: '{{ states.sensor.cryptocompare_sensors.attributes["BTC"]["USD"] }}'
      unit_of_measurement: 'USD'