Currency Exchange

Hello,

I would like to grab the historical and daily currency exchange and automate it for my workflow.
I found a FX_Currency workflow in Knime, however, I have been receiving the following error:

library(priceR)

  • data ← historical_exchange_rates(knime.flow.in[[“FX_FROM”]], to = knime.flow.in[[“FX_TO”]], start_date = knime.flow.in[[“DATE”]], end_date = knime.flow.in[[“DATE”]])
  • data$date<-as.character(data$date)
  • knime.out<-data
    Error: i In index: 1.
    Caused by error in append_exchangeratehost_access_key():
    !
    Exchangerate.host access key not found.
    Please create one here: https://exchangerate.host/
    Then set it in your R environment with
    Sys.setenv(“EXCHANGERATEHOST_ACCESS_KEY”=“your_access_key”)
    E.g.
    Sys.setenv(“EXCHANGERATEHOST_ACCESS_KEY”=“afty4m2dmpcs1uyp9coimr5vjr4y27t2”)

Error: object of type ‘closure’ is not subsettable

I did get an exchange key from the website and ran it in the R itself but it gave me the following error:
Error: object ‘exchangerate’ not found

How can I get this worked? is there any other way to get the historical and live exchange rate data?

Hello @spiltan,

Do you have the workflow you are using that you can post?

As an alternative I went to the api endpoint you provided and came up with a basic workflow using python script to ping the endpoints.

For the free tier, you cannot change source, so currently its limited to USD as source and you can only do live and historical pricing based on their documentation.

Here is the bottom half of the workflow that gets the exchange rate based on USD.

The top half above gets historical data:

This is a simplistic workflow, but it should give you an idea of how to get the api requests working.

Here is the workflow below if you would like to use it:

Hope this helps,
TL

4 Likes

thank you so much for your response. I am not looking for anything complicated, just simply getting the historical and daily rates.
I tried to use your workflow, I received the following error in conda environment:

I wonder if I need to reinstall Conda?

Hello @spiltan,

The Conda propogation node creates a new conda environment with the required packages for your workflow. So, during this process its normal to display that message. Please wait till the installation is complete (whrn the conda propogation node turns green).

image

Best,
Keerthan

2 Likes

thanks for your response! I was able to set up the conda environment, but now getting this error:

SSLError: HTTPSConnectionPool(host=‘api.exchangerate.host’, port=443): Max retries exceeded with url: /historical?access_key=“myaccesskey”&date=2024-12-09&currencies=INR (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1149)’)))

What can I do now?