Giter Site home page Giter Site logo

fixerapi's Introduction

License: MIT CRAN_Status_Badge GitHub tag R build status AppVeyor Build Status Coverage Status DOI

fixerapi

fixerapi is 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. Full API documentation is available here, and additional details are available in the vignette

Installation

To install from CRAN, use:

install.packages("fixerapi")

You can install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("evanodell/fixerapi")

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 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.

library(fixer)
today_symbols <- fixer_latest(base = "EUR", 
                              symbols = c("JPY", "GBP", "USD", "CAD", "CHF"))

print(today_symbols)

#> A tibble: 5 x 2
#>   name    value
#>   <chr>   <dbl>
#> 1 JPY   131.   
#> 2 GBP     0.873
#> 3 USD     1.23 
#> 4 CAD     1.57 
#> 5 CHF     1.18 

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

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

This project is not affiliated with or supported by fixer.io.

To cite package fixerapi in publications use:

Odell E (2018). fixerapi: An R Client for the “Fixer.io” Currency API. doi: 10.5281/zenodo.1211687 (URL: http://doi.org/10.5281/zenodo.1211687), R package version 0.1.6, <URL: https://docs.evanodell.com/fixerapi>.

A BibTeX entry for LaTeX users is

  @Manual{,
    title = {{fixerapi}: An R Client for the "Fixer.io" Currency API},
    author = {Evan Odell},
    year = {2018},
    note = {R package version 0.1.6},
    doi = {10.5281/zenodo.1211687},
    url = {https://docs.evanodell.com/fixerapi},
  }

fixerapi's People

Contributors

evanodell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

mhasanbulli

fixerapi's Issues

Error message: You have entered an invalid date. [Required format: date=YYYY-MM-DD]

Hello,

This error comes up when fixer_historical() function is called. Following is a simple example that can produce this error.

library(fixerapi)

Sys.setenv(FIXER_API_KEY = "<API_Key>")
fixer_historical(date = "2018-05-18")

The reason behind this error is the ifelse() function in fixer_historical(). By default, ifelse() strips all of the attributes of its variables. For example,

> ifelse(is.null(NULL), as.Date("2018-01-01"), 0)
[1] 17532

One way to resolve is to restore the class() of the original variable. Or, you can simply pass the date variable in with as.character().

I can do a pull request for this if you like.

Cheers.

Error in as.POSIXct.default

I tried:

fixer_convert("EUR", "USD", 1)

but it returns an error

Error in as.POSIXct.default(df$info$timestamp, origin = "1970-01-01", : do not know how to convert 'df$info$timestamp' to class “POSIXct”

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.