Version: | 0.1.6 |
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. |
License: | MIT + file LICENSE |
URL: | https://docs.evanodell.com/fixerapi |
BugReports: | https://github.com/evanodell/fixerapi/issues |
LazyData: | true |
ByteCompile: | true |
Imports: | jsonlite, tibble, tidyr |
Suggests: | testthat, covr, knitr, rmarkdown |
RoxygenNote: | 6.1.0 |
Encoding: | UTF-8 |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2018-08-23 09:53:52 UTC; evanodell |
Author: | Evan Odell |
Maintainer: | Evan Odell <evanodell91@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2018-08-23 10:14:25 UTC |
fixerapi: an R client for the fixer.io currency api
Description
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.
Set account type
Description
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.
Usage
fixer_account_type(type = c("free", "paid"))
Arguments
type |
Your fixer.io account type. Accepts
one of |
Examples
## Not run:
fixer_account_type("paid")
## End(Not run)
Fixer API Key
Description
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.
Usage
fixer_api_key(force = FALSE)
Arguments
force |
If |
Convert currencies
Description
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.
Usage
fixer_convert(from, to, amount = 1, date = NULL)
Arguments
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 |
Value
A list containing the value of the conversion, the exchange rate and the date and time of the currency conversion.
Examples
## 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)
Currency fluctuation
Description
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.
Usage
fixer_fluctuation(start_date, end_date, base = "EUR", symbols = NULL)
Arguments
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
|
Value
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.
See Also
fixer_time_series
Examples
## Not run:
x <- fixer_fluctuation(start_date = "2018-02-25", end_date = "2018-02-26",
symbols = c("USD", "JPY"))
## End(Not run)
Historic exchange rates
Description
Historical exchange rates are only available on paid fixer.io accounts.
Usage
fixer_historical(date = NULL, base = "EUR", symbols = NULL)
Arguments
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 |
Value
A tibble with exchange rates to the base currency on a given date.
Examples
## Not run:
historical <- fixer_historical(date = "2017-05-18")
## End(Not run)
Latest exchange rates
Description
Returns a tibble with the most recently available currency conversion data available from the Fixer API.
Usage
fixer_latest(base = "EUR", symbols = NULL)
Arguments
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
|
Value
A tibble with the latest available currency exchange data.
Examples
## 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)
Currency symbols
Description
Returns a tibble with the symbol and name of all currencies available through the Fixer API.
Usage
fixer_symbols()
Exchange rate time series
Description
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.
Usage
fixer_time_series(start_date, end_date, base = "EUR", symbols = NULL)
Arguments
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
|
Value
A tibble with the exchange rate from the base currency to the given currency symbols for each date in the requested range.
See Also
fixer_fluctuation
Examples
## 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)