setSymbolLookup           package:quantmod           R Documentation

_M_a_n_a_g_e _S_y_m_b_o_l _L_o_o_k_u_p _T_a_b_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     Create and manage Symbol defaults lookup table within R session
     for use in 'getSymbols' calls.

_U_s_a_g_e:

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

     saveSymbolLookup(file,dir="")
     loadSymbolLookup(file,dir="")

_A_r_g_u_m_e_n_t_s:

     ...: name=value pairs for symbol defaults 

 Symbols: name of symbol(s) 

 confirm: warn before deleting lookup table 

    file: filename 

     dir: directory of filename 

_D_e_t_a_i_l_s:

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

     Different sources (e.g. yahoo, MySQL, csv), 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, or list of
     Symbol specific parameters.

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

     It is also possible to specify additional, possibly source
     specific, lookup details on a per symbol basis.  These include an
     alternate naming convention (useful for sites like Yahoo! where
     certain non-traded symbols are prepended with a caret, or more
     correctly a curcumflex accent. In that case one would specify
     'setSymbolLookup(DJI=list(name="^DJI",src="yahoo"))') as well as
     passed parameters like 'dbname' and 'password' for database
     sources. See the specific getSymbols function related to the
     source in question for more details of each implementation.

     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' with the appropriate
     parameters from a startup file (e.g. .Rprofile) or to use
     'saveSymbolLookup' and 'loadSymbolLookup' to save and restore
     lookup tables.

     To unset a specific Symbol's defaults, simply assign 'NULL' to the
     Symbol.

_V_a_l_u_e:

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

_N_o_t_e:

     Changes are _NOT_ persistent across sessions, as the table is
     stored in the session options by default.

     This _may_ change to allow for an easier to manage process, as for
     now it is designed to minimize the clutter created during a
     typical session.

_A_u_t_h_o_r(_s):

     Jeffrey A. Ryan

_S_e_e _A_l_s_o:

     'getSymbols', 'options',

_E_x_a_m_p_l_e_s:

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

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

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

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

     ## OR

     saveSymbolLookup()
     loadSymbolLookup()

