This is a package to interface with the exchangerate.host API. The exchangerate.host is an API that can get the currency exchange rate and the history trend of the currency.
For more information about the API, you can visit the website: https://exchangerate.host/#/
This function need the user input the currency to change from and the currency to change to. It returns a list of length two containing the exchange rate and date.
source("../R/convert_currency.r") convert_currency("CAD", "USD")
This function need the user input the start date, end date and the base currency and return dataframe of the currency exchange rate during the time period.
source("../R/currency_time_series.R") currency_time_series("2020-01-01","2020-01-05","CAD")
This function need the user input the start date, end date, base currency and the aim currency and return the plot of the currency exchange rate between the 2 currency during the time period.
options(repr.plot.width = 15, repr.plot.height = 8) source("../R/history_trend_plot.R") history_trend_plot("2017-12-01","2018-12-31","CAD","USD")
This function need the user input the base currency, aim currencies, and the amount and return dataframe of the latest foreign exchange reference rates of a list of currencies on a specific base at a specific amount on daily basis.
source("../R/latest_rates.R") latest_rates('CAD','USD,CNH,JPY,HKD,GBP',1000)
This function need the user input the start date, the end date, the base currency, aim currencies, and the amount and return dataframe of the fluctuation information about a list of currencies on a specific base at a specific amount on a day-to-day basis.
source("../R/fluctuation.R") df<-fluctuation('2021-02-01','2021-05-10', base='CNH', symbols='USD,CAD,JPY,HKD,GBP', amount=1000) df
Now, let us draw a plot to show the relation between currency and the rate change percentage.
source("../R/fluctuation.R") df <- cbind(currency = rownames(df), df) rownames(df) <- 1:nrow(df) ggplot(df, aes(x =currency , y = as.numeric(Rates.change_pct))) + geom_point()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.