FinancialInstrument (version 1.3.1)

parse_id: 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.

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)

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.

See Also

parse_suffix

Examples

Run this code
# NOT RUN {
parse_id("ES_Z11")
parse_id("CLZ1")
parse_id("SPY_111217C130")
# }

Run the code above in your browser using DataCamp Workspace