View source: R/ls_by_currency.R
| ls_by_currency | R Documentation |
Returns the names of instruments denominated in one or more specified currencies.
ls_by_currency(currency, pattern = NULL, match = TRUE, show.currencies = FALSE)
rm_by_currency(x, currency, keep.currencies = TRUE)
ls_USD(pattern = NULL, match = TRUE, show.currencies = FALSE)
ls_AUD(pattern = NULL, match = TRUE, show.currencies = FALSE)
ls_GBP(pattern = NULL, match = TRUE, show.currencies = FALSE)
ls_CAD(pattern = NULL, match = TRUE, show.currencies = FALSE)
ls_EUR(pattern = NULL, match = TRUE, show.currencies = FALSE)
ls_JPY(pattern = NULL, match = TRUE, show.currencies = FALSE)
ls_CHF(pattern = NULL, match = TRUE, show.currencies = FALSE)
ls_HKD(pattern = NULL, match = TRUE, show.currencies = FALSE)
ls_SEK(pattern = NULL, match = TRUE, show.currencies = FALSE)
ls_NZD(pattern = NULL, match = TRUE, show.currencies = FALSE)
currency |
Character vector containing the names of currencies. |
pattern |
An optional regular expression. Only instrument names matching 'pattern' are returned. |
match |
Logical. Should 'pattern' be matched exactly? |
show.currencies |
Logical. Should currency instruments themselves be included in the returned names? |
x |
Character vector of instrument names to remove. If missing, all instruments denominated in 'currency' are selected. |
keep.currencies |
Logical. If 'TRUE', retain the currency instruments themselves. |
A character vector containing instrument names denominated in the requested currencies, or 'NULL' when no matching instruments are found.
Garrett See
[ls_instruments()], [ls_currencies()], [rm_instruments()], [rm_currencies()], [instrument()]
example_dir <- tempfile("fi-currency-")
dir.create(example_dir)
backup_name <- "backup.RData"
backup_path <- file.path(example_dir, backup_name)
saveInstruments(backup_name, dir = example_dir)
tryCatch(
{
rm_instruments(keep.currencies = FALSE)
currency(c("USD", "CAD", "GBP"))
stock(c("CM", "CNQ"), currency = "CAD")
stock(c("BARC", "BET"), currency = "GBP")
stock(c("DIA", "SPY"), currency = "USD")
ls_by_currency("CAD")
ls_by_currency("GBP")
ls_USD()
ls_CAD()
rm_by_currency(currency = "CAD")
},
finally = {
if (file.exists(backup_path)) {
reloadInstruments(
backup_name,
dir = example_dir
)
}
unlink(example_dir, recursive = TRUE)
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.