Learn R Programming

quantmod (version 0.2-1)

setSymbolLookup: Manage Symbol Lookup Table

Description

Create and manage Symbol defaults lookup table within Rsession for use in getSymbols calls.

Usage

setSymbolLookup(...)
getSymbolLookup(Symbols=NULL)
unsetSymbolLookup(Symbols,confirm=TRUE)

Arguments

...
name=value pairs for symbol defaults
Symbols
name of symbol(s)
confirm
warn before deleting lookup table

Value

  • Called for its side effects, the function changes the options value for the specified Symbol through a call to options(getSymbols.sources=...)

Details

Use of these functions allows the user to specify a default scheme for each Symbol to be loaded.

Different sources (e.g. yahoo, MySQL), can be specified for each Symbol of interest. The sources must be valid getSymbols methods - see getSymbols for details on which methods are available, as well as how to add additional methods.

The argument list to setSymbolLookup is simply the unquoted name of the Symbol matched to the desired default source.

For example, to signify that the stock data for Sun Microsystems (SUNW) should be downloaded from Yahoo! Finance, one would call setSymbolLookup(SUNW='yahoo')

All changes are made to the current list, and will persist only until the end of the session. To always use the same defaults it is necessary to call setSymbolLookup from a startup file (e.g. .Rprofile)

See Also

getSymbols, options,

Examples

Run this code
setSymbolLookup(QQQQ='yahoo',DIA='MySQL')
getSymbolLookup('QQQQ')
getSymbolLookup(c('QQQQ','DIA'))

## Will download QQQQ from yahoo
## and load DIA from MySQL
getSymbols(c('QQQQ','DIA'))

## Use something like this to always retrieve
## from the same source

.First <- function() {
  require(quantmod,quietly=TRUE)
  quantmod::setSymbolLookup(SUNW="MySQL")
}

Run the code above in your browser using DataLab