Return a data.frame of financial indices (currencies) given a vector of symbols, e.g., 'EUR'.
Optionally, it can filter the results and add the last market price ('USD') of these currencies.
Arguments
- keep
character- Character vector of symbols to filter the results (perl expression, ignoring case). IfNULL(default), no filtering is applied, and all available indices are returned.- get_changes
logical, default =FALSE- IfTRUE, add latest market values ('USD') fromget_changes(). Seeget_changes()for the base structure.- .verbose
logical, default =TRUE- IfTRUE, send messages to the console if necessary.
Value
A data.frame containing unique financial indices (currencies). The table has
columns like symbol, name, and other relevant information, with all column names in lowercase.
If keep is specified, only the matching currencies are returned. If get_changes is specified, last market values in 'USD' will be added, see get_changes().
Details
Return a data.frame with additional attributes:
- n.currencies
integer- Number of unique currencies in thedata.frame.- currencies
character- A vector of currency symbols in thedata.frame(e.g.,"BTC","ETH","USD").- exchange
character- A vector of exchange pairs (e.g.,"BTC => USD"). If not applicable,NULL(no entry).- date.fetch
Date- The date when the data was retrieved, set usingSys.Date().- crypto
logical-TRUEif cryptocurrencies are present, otherwiseFALSE.- date.begin
POSIXct- The oldest observation in the dataset.- date.end
POSIXct- The most recent observation in the dataset.- date.dif
numeric- The number of seconds between date.begin and date.end, equivalent ofdifftimevalue.
See also
For more details see the help vignette:
vignette("currencies", package = "financr")
Examples
# Fetch all available indices
all_indices <- last_currencies( keep = "LBP" , get_changes = TRUE)
# Fetch only specific indices
selected_indices <- last_currencies(keep = c("^Z", "EUR"))
