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 2022-08-21 23:00:00 1.183852 1.174260 1.181768 1.181810 0 1.181810
#> 2 2022-08-22 23:00:00 1.187324 1.172003 1.176706 1.176651 0 1.176651
#> 3 2022-08-23 23:00:00 1.186535 1.175876 1.183152 1.183278 0 1.183278
#> 4 2022-08-24 23:00:00 1.186296 1.178592 1.179023 1.179176 0 1.179176
#> 5 2022-08-25 23:00:00 1.190009 1.175309 1.182592 1.182401 0 1.182401
#> 6 2022-08-28 23:00:00 1.174260 1.164958 1.169180 1.169454 0 1.169454
#> 7 2022-08-29 23:00:00 1.175807 1.162304 1.172127 1.172251 0 1.172251
#> 8 2022-08-30 23:00:00 1.169454 1.160025 1.166086 1.165977 0 1.165977
#> 9 2022-08-31 23:00:00 1.161710 1.150324 1.159689 1.159851 0 1.159851
#> 10 2022-09-01 23:00:00 1.158856 1.153136 1.154734 1.154894 0 1.154894
#> 11 2022-09-04 23:00:00 1.152074 1.144518 1.147855 1.147460 0 1.147460
#> 12 2022-09-05 23:00:00 1.160766 1.149624 1.156885 1.156644 0 1.156644
#> 13 2022-09-06 23:00:00 1.152366 1.140953 1.151278 1.151185 0 1.151185
#> 14 2022-09-07 23:00:00 1.156016 1.146158 1.152246 1.151981 0 1.151981
#> 15 2022-09-08 23:00:00 1.164863 1.151662 1.152047 1.152160 0 1.152160
#> 16 2022-09-11 23:00:00 1.171125 1.160174 1.161805 1.161940 0 1.161940
#> 17 2022-09-12 23:00:00 1.173764 1.152034 1.168975 1.168975 0 1.168975
#> 18 2022-09-13 23:00:00 1.158937 1.148079 1.150351 1.150616 0 1.150616
#> 19 2022-09-14 23:00:00 1.154868 1.146986 1.154294 1.154494 0 1.154494
#> 20 2022-09-15 23:00:00 1.148066 1.135267 1.145475 1.145265 0 1.145265
#> 21 2022-09-18 23:00:00 1.144165 1.135576 1.143641 1.143314 0 1.143314
#> 22 2022-09-20 06:22:17 1.145974 1.140823 1.143602 1.142923 0 1.142923
# }