Skip to contents

Retrieve current conversion rate between two currencies as well as historical rates.

Usage

currency_converter(
  from = "EUR",
  to = "USD",
  start = NULL,
  end = NULL,
  period = "ytd",
  interval = "1d"
)

Arguments

from

Currency to convert from.

to

Currency to convert to.

start

Specific starting date. String or date object in yyyy-mm-dd format.

end

Specific ending date. String or date object in yyyy-mm-dd format.

period

Length of time. Defaults to 'ytd' Valid values are:

  • '1d'

  • '5d'

  • '1mo'

  • '3mo'

  • '6mo'

  • '1y'

  • '2y'

  • '5y'

  • '10y'

  • 'ytd'

  • 'max'

interval

Time between data points. Defaults to '1d' Valid values are:

  • '1h'

  • '1d'

  • '5d'

  • '1wk'

  • '1mo'

  • '3mo'

Value

A data.frame.

Examples

# \donttest{
currency_converter('GBP', 'USD', '2022-07-01', '2022-07-10')
#>                  date     high      low     open    close volume adj_close
#> 1 2022-06-30 23:00:00 1.216205 1.198064 1.215998 1.216086      0  1.216086
#> 2 2022-07-03 23:00:00 1.216515 1.208634 1.210580 1.210273      0  1.210273
#> 3 2022-07-04 23:00:00 1.212606 1.190051 1.211402 1.211446      0  1.211446
#> 4 2022-07-05 23:00:00 1.198638 1.187761 1.194957 1.194914      0  1.194914
#> 5 2022-07-06 23:00:00 1.202183 1.191001 1.191895 1.192321      0  1.192321
#> 6 2022-07-07 23:00:00 1.205531 1.192194 1.203196 1.202805      0  1.202805
currency_converter('GBP', 'USD', period = '1mo', interval = '1d')
#>                   date     high      low     open    close volume adj_close
#> 1  2024-10-13 23:00:00 1.307224 1.303152 1.304938 1.304904      0  1.304904
#> 2  2024-10-14 23:00:00 1.310187 1.303628 1.306848 1.306745      0  1.306745
#> 3  2024-10-15 23:00:00 1.307737 1.298364 1.306558 1.306592      0  1.306592
#> 4  2024-10-16 23:00:00 1.302032 1.297589 1.299174 1.299022      0  1.299022
#> 5  2024-10-17 23:00:00 1.306865 1.301236 1.301609 1.301575      0  1.301575
#> 6  2024-10-20 23:00:00 1.305313 1.297976 1.305142 1.305262      0  1.305262
#> 7  2024-10-21 23:00:00 1.301524 1.294649 1.298313 1.298297      0  1.298297
#> 8  2024-10-22 23:00:00 1.299613 1.293761 1.298196 1.298280      0  1.298280
#> 9  2024-10-23 23:00:00 1.298684 1.291222 1.291639 1.291372      0  1.291372
#> 10 2024-10-24 23:00:00 1.299917 1.295706 1.297404 1.297337      0  1.297337
#> 11 2024-10-28 00:00:00 1.300086 1.294063 1.295824 1.295824      0  1.295824
#> 12 2024-10-29 00:00:00 1.300762 1.295840 1.297555 1.297471      0  1.297471
#> 13 2024-10-30 00:00:00 1.303934 1.293946 1.301168 1.301406      0  1.301406
#> 14 2024-10-31 00:00:00 1.299883 1.284752 1.295874 1.295958      0  1.295958
#> 15 2024-11-01 00:00:00 1.297926 1.288544 1.289474 1.289773      0  1.289773
#> 16 2024-11-04 00:00:00 1.300052 1.293628 1.295303 1.295340      0  1.295340
#> 17 2024-11-05 00:00:00 1.302134 1.294884 1.295337 1.295454      0  1.295454
#> 18 2024-11-06 00:00:00 1.304376 1.283631 1.304053 1.304359      0  1.304359
#> 19 2024-11-07 00:00:00 1.300915 1.287747 1.288328 1.288328      0  1.288328
#> 20 2024-11-08 00:00:00 1.298533 1.290323 1.298364 1.298229      0  1.298229
#> 21 2024-11-11 00:00:00 1.292658 1.285661 1.291573 1.291706      0  1.291706
#> 22 2024-11-12 00:00:00 1.287416 1.273123 1.287416 1.287498      0  1.287498
#> 23 2024-11-13 00:00:00 1.276243 1.268955 1.273739 1.273918      0  1.273918
#> 24 2024-11-14 16:19:24 1.271165 1.262977 1.270664 1.270906      0  1.270906
# }