Title: | An R Client for the "Fixer.io" Currency API |
---|---|
Description: | An R client for the "fixer.io" currency conversion and exchange rate API. The API requires registration and some features are only available on paid accounts. The full API documentation is available at <https://fixer.io/documentation>. |
Authors: | Evan Odell [aut, cre] |
Maintainer: | Evan Odell <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.6.9000 |
Built: | 2024-10-31 16:33:18 UTC |
Source: | https://github.com/evanodell/fixerapi |
Paid accounts have access to additional features, including
SSL encryption of API requests using HTTPS. Account type must be set in
order to use HTTPS requests. Setting account type to "paid"
when
using a free account will result in an error, even on features available to
free accounts. Setting account type to "free"
when using a paid
account will have no impact on requests aside from using HTTP instead of
HTTPS to access the API. If you have a paid account but do not set
your account status you will not be able to use the HTTPS connection but
there will be no other impact on your usage of the API.
The fixer.io API still checks the account type when receiving requests, so setting you account type here only forces HTTPS instead of HTTP.
Setting the environmental variable FIXER_ACT_TYPE
to one of
"free"
or "paid"
will negate the need to use this function every time the
package is used.
fixer_account_type(type = c("free", "paid"))
fixer_account_type(type = c("free", "paid"))
type |
Your fixer.io account type. Accepts
one of |
## Not run: fixer_account_type("paid") ## End(Not run)
## Not run: fixer_account_type("paid") ## End(Not run)
fixer.io requires an API key, which is saved as an
environmental variable. In interactive mode, using fixer_api_key
will prompt you to enter an API key. You can also use
Sys.setenv(FIXER_API_KEY = <key>)
to set the API key.
fixer_api_key(force = FALSE)
fixer_api_key(force = FALSE)
force |
If |
By default fixerapi
will look for the environment variable
FIXER_API_KEY
when the package is loaded.
Convert from one currency to another, on a given date or using the latest available exchange rates.
Currency conversion is available on all paid plans.
fixer_convert(from, to, amount = 1, date = NULL)
fixer_convert(from, to, amount = 1, date = NULL)
from |
Symbol of currency to convert from. |
to |
Symbol of currency to convert to. |
amount |
The numeric value of the |
date |
Optional variable. A date in YYYY-MM-DD format, or any value
that can be coerced to YYYY-MM-DD format with |
A list containing the value of the conversion, the exchange rate and the date and time of the currency conversion.
## Not run: x <- fixer_convert(from = "GBP", to = "JPY", amount = 25) y <- fixer_convert(from = "GBP", to = "JPY", amount = 25, date = "2018-05-05") ## End(Not run)
## Not run: x <- fixer_convert(from = "GBP", to = "JPY", amount = 25) y <- fixer_convert(from = "GBP", to = "JPY", amount = 25, date = "2018-05-05") ## End(Not run)
Returns fluctuation in currency exchange rates for one or more currencies compared to the base currency over a given period of time. The maximum time frame is 365 days.
Currency fluctuation data is only available for "Professional Plus" and "Enterprise" accounts.
fixer_fluctuation(start_date, end_date, base = "EUR", symbols = NULL)
fixer_fluctuation(start_date, end_date, base = "EUR", symbols = NULL)
start_date |
The start date of requested time series, in "YYYY-MM-DD"
style, or any style convertable to "YYYY-MM-DD" using |
end_date |
The end date of requested time series, in "YYYY-MM-DD"
style, or any style convertable to "YYYY-MM-DD" using |
base |
The base currency to index other currencies against. Defaults
to |
symbols |
A character vector of the symbols of currencies to return
exchange rates for, or a string for a single currency. Defaults to
|
A tibble with the currency symbol, start rate, end rate, change and change percentage over the requested time period. Each currency is given its own row, with start rate, end rate, change and change percentage each in their own columns.
## Not run: x <- fixer_fluctuation(start_date = "2018-02-25", end_date = "2018-02-26", symbols = c("USD", "JPY")) ## End(Not run)
## Not run: x <- fixer_fluctuation(start_date = "2018-02-25", end_date = "2018-02-26", symbols = c("USD", "JPY")) ## End(Not run)
Historical exchange rates are only available on paid fixer.io accounts.
fixer_historical(date = NULL, base = "EUR", symbols = NULL)
fixer_historical(date = NULL, base = "EUR", symbols = NULL)
date |
A date in YYYY-MM-DD format, or any value that can be coerced
to YYYY-MM-DD format with |
base |
The base currency to index other currencies against.
Defaults to |
symbols |
The symbols of currencies to return exchange rates for.
Defaults to |
A tibble with exchange rates to the base currency on a given date.
## Not run: historical <- fixer_historical(date = "2017-05-18") ## End(Not run)
## Not run: historical <- fixer_historical(date = "2017-05-18") ## End(Not run)
Returns a tibble with the most recently available currency conversion data available from the Fixer API.
fixer_latest(base = "EUR", symbols = NULL)
fixer_latest(base = "EUR", symbols = NULL)
base |
The base currency to index other currencies against. Defaults
to |
symbols |
A character vector of the symbols of currencies to return
exchange rates for, or a string for a single currency. Defaults to
|
A tibble with the latest available currency exchange data.
## Not run: today <- fixer_latest() today_usd <- fixer_latest(base = "USD") today_symbols <- fixer_latest(base = "USD", symbols = c("EUR", "JPY", "CAD")) ## End(Not run)
## Not run: today <- fixer_latest() today_usd <- fixer_latest(base = "USD") today_symbols <- fixer_latest(base = "USD", symbols = c("EUR", "JPY", "CAD")) ## End(Not run)
Returns a tibble with the symbol and name of all currencies available through the Fixer API.
fixer_symbols()
fixer_symbols()
Time series plans are only available on "professional" and above plans. The maximum allowed length in a single request is 365 days.
Each currency symbol is displayed in its own column, with a value relative to the base currency on the given date.
Time series data is only available for "Professional", "Professional Plus" and "Enterprise" accounts.
fixer_time_series(start_date, end_date, base = "EUR", symbols = NULL)
fixer_time_series(start_date, end_date, base = "EUR", symbols = NULL)
start_date |
The start date of requested time series, in "YYYY-MM-DD"
style, or any style convertable to "YYYY-MM-DD" using |
end_date |
The end date of requested time series, in "YYYY-MM-DD"
style, or any style convertable to "YYYY-MM-DD" using |
base |
The base currency to index other currencies against. Defaults
to |
symbols |
A character vector of the symbols of currencies to return
exchange rates for, or a string for a single currency. Defaults to
|
A tibble with the exchange rate from the base currency to the given currency symbols for each date in the requested range.
## Not run: x <- fixer_time_series(start_date = "2017-04-30", end_date = "2017-06-20", base = "GBP", symbols = c("USD", "EUR")) ## End(Not run)
## Not run: x <- fixer_time_series(start_date = "2017-04-30", end_date = "2017-06-20", base = "GBP", symbols = c("USD", "EUR")) ## End(Not run)
The fixer.io API provides real-time exchange rates for 170 currencies, covering 1999 to the present. fixer.io requires an account and a private key, and most features require a paid account. See the full API documentation for more details on account features and pricing.