parse_id {FinancialInstrument}R Documentation

Parse a primary_id

Description

Extract/infer descriptive information about an instrument from its name.

Usage

parse_id(x, silent = TRUE, root = NULL)

Arguments

x

the id to be parsed (e.g. ‘ES_U11’, ‘SPY_111217C130’)

silent

silence warnings?

root

character name of instrument root_id. Optionally provide this to make parsing easier.

Details

This function is primarily intended to be used on the names of future_series and option_series instruments, and it will work best if the id has an underscore in it that separates the root_id from the suffix_id. (However, it should be able to handle most ids even if the underscore is missing). After splitting x into a root_id and suffix_id, the suffix_id is passed to parse_suffix (see also) for further processing.

TODO: add support for bond_series.

Value

a list of class ‘id.list’ containing ‘root’ and ‘suffix’ as well as what is returned from parse_suffix (type, month, year, strike, right, cm, cc, format)

Note

this function will identify x as an exchange_rate only if it is 6 characters long and made up of 2 previously defined currency instruments.

Author(s)

Garrett See

See Also

parse_suffix

Examples

parse_id("ES_Z11")
parse_id("CLZ1")
parse_id("SPY_111217C130")

[Package FinancialInstrument version 1.3.1 Index]