lookupSecurity: Look up symbol from Bloomberg

View source: R/lookup.R

lookupSecurityR Documentation

Look up symbol from Bloomberg

Description

This function uses the Bloomberg API to look up tickers and descriptions given the name of a company.

Usage

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())

Arguments

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 blpConnect call, and retrieved via the internal function defaultConnection.

Value

A data.frame with two columns of the ticker and description of each match.

Author(s)

Kevin Jin and Dirk Eddelbuettel

Examples

## 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)

Rblpapi documentation built on Sept. 30, 2024, 5:08 p.m.