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
ordate
object inyyyy-mm-dd
format.- end
Specific ending date.
String
ordate
object inyyyy-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'
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 2023-07-10 23:00:00 1.293326 1.285975 1.286323 1.286471 0 1.286471
#> 2 2023-07-11 23:00:00 1.300221 1.290506 1.293494 1.293477 0 1.293477
#> 3 2023-07-12 23:00:00 1.311338 1.299022 1.299798 1.299630 0 1.299630
#> 4 2023-07-13 23:00:00 1.314233 1.309518 1.313146 1.312853 0 1.312853
#> 5 2023-07-16 23:00:00 1.310719 1.305449 1.309123 1.309020 0 1.309020
#> 6 2023-07-17 23:00:00 1.312456 1.305125 1.307087 1.307172 0 1.307172
#> 7 2023-07-18 23:00:00 1.303951 1.287167 1.303509 1.303509 0 1.303509
#> 8 2023-07-19 23:00:00 1.296512 1.284192 1.293979 1.293979 0 1.293979
#> 9 2023-07-20 23:00:00 1.290389 1.281788 1.286968 1.287233 0 1.287233
#> 10 2023-07-23 23:00:00 1.288344 1.279918 1.285182 1.285347 0 1.285347
#> 11 2023-07-24 23:00:00 1.287730 1.281066 1.281246 1.281263 0 1.281263
#> 12 2023-07-25 23:00:00 1.293628 1.287614 1.289341 1.289391 0 1.289391
#> 13 2023-07-26 23:00:00 1.299545 1.282726 1.292858 1.292725 0 1.292725
#> 14 2023-07-27 23:00:00 1.288527 1.276471 1.279427 1.279378 0 1.279378
#> 15 2023-07-30 23:00:00 1.287333 1.282956 1.285380 1.285397 0 1.285397
#> 16 2023-07-31 23:00:00 1.283862 1.274161 1.283203 1.283401 0 1.283401
#> 17 2023-08-01 23:00:00 1.279738 1.268183 1.279116 1.279574 0 1.279574
#> 18 2023-08-02 23:00:00 1.272848 1.262594 1.271763 1.272038 0 1.272038
#> 19 2023-08-03 23:00:00 1.278266 1.269164 1.271617 1.271634 0 1.271634
#> 20 2023-08-06 23:00:00 1.278609 1.271391 1.275120 1.274795 0 1.274795
#> 21 2023-08-07 23:00:00 1.278593 1.268585 1.278593 1.278200 0 1.278200
#> 22 2023-08-08 23:00:00 1.277841 1.271246 1.274437 1.274161 0 1.274161
#> 23 2023-08-09 23:00:00 1.281132 1.271084 1.271892 1.272006 0 1.272006
#> 24 2023-08-10 23:00:00 1.273707 1.266624 1.266624 1.267009 0 1.267009
#> 25 2023-08-11 21:29:58 1.273772 1.266672 1.267893 1.269487 0 1.269487
# }