load.instruments: load instrument metadata into the .instrument environment

Description Usage Arguments Details See Also Examples

Description

This function will load instrument metadata (data about the data) either from a file specified by the file argument or from a data.frame specified by the metadata argument.

Usage

1
2
load.instruments(file = NULL, ..., metadata = NULL, id_col = 1,
  default_type = "stock", identifier_cols = NULL, overwrite = TRUE)

Arguments

file

string identifying file to load, default NULL, see Details

...

any other passthru parameters

metadata

optional, data.frame containing metadata, default NULL, see Details

id_col

numeric column containing id if primary_id isn't defined, default 1

default_type

character string to use as instrument type fallback, see Details

identifier_cols

character vector of field names to be passed as identifiers, see Details

overwrite

TRUE/FALSE. See instrument.

Details

The function will attempt to make reasonable assumptions about what you're trying to do, but this isn't magic.

You will typically need to specify the type of instrument to be loaded, failure to do so will generate a Warning and default_type will be used.

You will need to specify a primary_id, or define a id_col that contains the data to be used as the primary_id of the instrument.

You will need to specify a currency, unless the instrument type is 'currency'

Use the identifier_cols argument to specify which fields (if any) in the CSV are to be passed to instrument as the identifiers argument

Typically, columns will exist for multiplier and tick_size.

Any other columns necessary to define the specified instrument type will also be required to avoid fatal Errors.

Additional columns will be processed, either as additional identifiers for recognized identifier names, or as custom fields. See instrument for more information on custom fields.

See Also

loadInstruments, instrument, setSymbolLookup.FI, getSymbols, getSymbols.FI

Examples

1
2
3
4
5
6
7
## Not run: 
load.instruments(system.file('data/currencies.csv.gz',package='FinancialInstrument'))
load.instruments(system.file('data/root_contracts.csv.gz',package='FinancialInstrument'))
load.instruments(system.file('data/future_series.csv.gz',package='FinancialInstrument'))


## End(Not run)

FinancialInstrument documentation built on May 2, 2019, 3:41 a.m.