lookupSecurity | R Documentation |
This function uses the Bloomberg API to look up tickers and descriptions given the name of a company.
lookupSecurity(query, yellowkey = c("none", "cmdt", "eqty", "muni", "prfd",
"clnt", "mmkt", "govt", "corp", "indx", "curr", "mtge"),
language = c("none", "english", "kanji", "french", "german", "spanish",
"portuguese", "italian", "chinese_trad", "korean", "chinese_simp", "none_1",
"none_2", "none_3", "none_4", "none_5", "russian"), maxResults = 20,
verbose = FALSE, con = defaultConnection())
query |
A character variable describing the name of the company; for certain queries a trailing space may help. |
yellowkey |
A character variable that restricts the asset classes to search in; one of “none”, “cmdt”, “eqty”, “muni”, “prfd”, “clnt”, “mmkt”, “govt”, “corp”, “indx”, “curr”, “mtge”. |
language |
A character variable denoting the language that the results will be translated in; one of “NONE”, “english”, “kanji”, “french”, “german”, “spanish”, “portuguese”, “italian”, “chinese_trad”, “korean”, “chinese_simp”, “none_1”, “none_2”, “none_3”, “none_4”, “none_5”, “russian” |
maxResults |
A integer variable containing a value by which to limit the search length |
verbose |
A boolean indicating whether verbose operation is desired, defaults to ‘FALSE’ |
con |
A connection object as created by a |
A data.frame with two columns of the ticker and description of each match.
Kevin Jin and Dirk Eddelbuettel
## Not run:
lookupSecurity("IBM")
lookupSecurity("IBM", maxResuls=1000) # appears to be capped at 1000
lookupSecurity("IBM", "mtge")
lookupSecurity("IBM ", "mtge") # trailing space affects query
## modify the symbol column (cf issue ticket 215 at GitHub)
res <- lookupSecurity("IBM")
res[, "symbol"] <- sub(pattern="^(.+)<(.)(.+)>$", "\\1 \\U\\2\\E\\3",
perl=TRUE, res[, "security"])
res
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.