FinancialInstrument (version 1.3.1)

instrument.table: Create data.frame with attributes of all instruments

Description

A wrapper for buildHierarchy, that defaults to returning all attributes. By default it looks for the instrument with the most attribute levels, and uses those attributes for columns. If you would prefer to use the attribute levels of a given instrument to build the columns, use attrs.of.

Usage

instrument.table(symbols = NULL, exclude = NULL, attrs.of = NULL)

Arguments

symbols

A vector of instrument names to include

exclude

A vector of names of attributes that should not be included in the returned data.frame

attrs.of

name of a FinancialInstrument instrument. Returned data.frame columns will be the attributes of instrument.

Value

data.frame

Details

if there are some attributes that you do not want to be included in the returned data.frame, specify them with exclude.

See Also

buildHierarchy, instrument

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
currency('USD')
stock('GM','USD',exchange='NYSE')
stock('XOM','USD',description='Exxon Mobil')
instrument.table()
#Usually, currencies will not have as many attribute levels
#as other instruments, so you may want to exclude them from the table.
it <- instrument.table(exclude="USD|GM", attrs.of = "XOM") #columns created based on XOM instrument
#it <- instrument.table(exclude=c('USD','GM'), attrs.of = "XOM") #same thing
it <- instrument.table(exclude='tick_size|description|exchange')
# }

Run the code above in your browser using DataLab