Introduction

fixerapi is a package for accessing data from the fixer.io currency exchange rate API. The fixer.io API requires registration and the use of an API key. Free accounts are limited to 10,000 API calls a month, and can only access the most currency conversion rates, using the Euro as the base currency. For complete details, see the documentation on fixer.io.

Setting a key

Set your fixer.io API key with the fixer_api_key() function, or with Sys.setenv(FIXER_API_KEY = <key>). You can find your key on your fixer.io dashboard.

Setting an account type

If you have a paid account, setting your account type to “paid” with fixer_account_type("paid") switches to SSL connections over HTTPS, instead of the HTTP connection used by free accounts. Setting your account type does not have any other effects on your ability to use the fixer.io API. Features limited to certain levels of account are automatically limited by the Fixer API itself, and will return warning messages indicating as such.

Using fixerapi

To access a tibble with the name and currency symbol (a three letter code) for all currencies available through the API, use fixer_symbols().

There are five currency exchange query types, which fixer.io calls endpoints. They are:

  • Current exchange rates, accessed using fixer_latest() (available with free account)
  • Historical exchange rates on a given date, using fixer_historical() (available on all paid accounts)
  • Conversion from one currency to another, either currently or on a specific date, using fixer_convert() (available on all paid accounts)
  • A time series of up to 365 days showing daily exchange rates over that time, using fixer_time_series() (available on “professional” and higher grade accounts)
  • Exchange rate fluctuations over a period of up to 365 days, using fixer_fluctuation() (available on “professional plus” and “enterprise” grade accounts)

With the exception of fixer_convert(), which is limited to two currencies, all functions give an option for a base currency that is indexed to 1 and other currencies are compared to – the default is the Euro – and an option to limit the currencies it is compared with, using the symbols parameter, which takes a character vector of currency symbols. If no symbols are specified, all available currencies are returned.

The example above shows the exchange rates on 2018-04-03.

Free accounts are limited to the fixer_latest() function, and cannot change the base currency. Free accounts come with 10,000 calls per month, paid accounts with more, depending on the level of the paid account.

Full documentation for the API itself is available on the Fixer website, along with the signup.