sort_ids {FinancialInstrument} | R Documentation |
sort primary_ids of instruments
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
sort_ids(ids, ...)
Arguments
ids |
character vector of ids |
... |
arguments to pass through to |
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
Examples
## Not run:
ids <- c("ES_U11",'GLD','SPY',"YM_Jun11",'DIA','VX_V10')
sort_ids(ids)
## End(Not run)