Description Usage Arguments Details Value Author(s) See Also Examples
Using parse_id
, this will figure out where
in the month_cycle
that id
belongs. Then,
it will use the next (previous) month in
month_cycle
to construct the id of the
next-to-expire contract.
1 2 3 4 5 | next.future_id(id, month_cycle = seq(3, 12, 3),
root = NULL, format = NULL)
prev.future_id(id, month_cycle = seq(3, 12, 3),
root = NULL, format = NULL)
|
id |
character string primary_id of a future_series instrument |
month_cycle |
months in which contracts expire. numeric or month codes. See Details. |
root |
root_id. usually only used if there is no
underscore in the |
format |
how you would like the returned id to be
formatted. If NULL, it will match the format of
|
month_cycle
can be a numeric vector (corresponding
to the months in which contracts expire), or it can be a
vector of month codes, a vector of month abbreviations,
or a comma-delimited string of month codes or
abbreviations, in which case an attempt will be made to
convert it to a numeric vector. by passing it through
month_cycle2numeric
root
is primarily used when you have an id that
does not have an underscore, in which case, providing
root
will make splitting the id into primary_id
and suffix_id easier and more accurate. root
can
also be used if you want the returned id to be on a
different future
than the id you passed in (when
used this way, format
should also be used).
By default, (when called with format=NULL
) the
returned id will be of the same format as the id
that was passed in. The format of the returned id can be
specified with the format
argument. See
format_id
for supported values of
format
character
Garrett See
format_id
for supported values of
format
. month_cycle2numeric
1 2 3 | next.future_id("ES_Z1","H,M,U,Z", format=NULL)
next.future_id("VIXAUG11", 1:12, root='VIX', format=NULL)
next.future_id("YM_Q11", seq(3,12,3)) #gives a warning about 'Q' not being part of month_cycle
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.