sort_ids: sort primary_ids of instruments

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/format_id.R

Description

Primarily intended for use on the primary_ids of future_series instruments. This will sort ids by expiration. All ids that do not contain month and year information will be sorted alphabetically (separately) and appended to the end of the other sorted ids.

Usage

1
sort_ids(ids, ...)

Arguments

ids

character vector of ids

...

arguments to pass through to parse_id

Details

If an instrument is defined, and has a date in its ‘expires’ field, that date will be used as the expiration date. Otherwise, it is assumed that the contract expires on the first day of its expiration month. This means that if some products are defined and other products that expire in the same month are not defined, the ones that are not defined will come first in the vector of sorted ids.

Value

sorted character vector of the same length as ids

Author(s)

Garrett See

See Also

parse_id

Examples

1
2
3
4
5
## Not run: 
ids <- c("ES_U11",'GLD','SPY',"YM_Jun11",'DIA','VX_V10')
sort_ids(ids)

## End(Not run)

FinancialInstrument documentation built on May 2, 2019, 5:24 p.m.