expires: extract the correct expires value from an 'instrument'

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

View source: R/expires.R

Description

Currently, there are methods for instrument, spread, character, and xts

Usage

1

Arguments

x

instrument or name of instrument

...

arguments to be passed to methods

Details

Will return either the last expiration date before a given Date, or the first expiration date after a given Date (if expired==FALSE).

If an instrument contains a value for expires that does not include a day (e.g. "2012-03"), or if the expires value is estimated from a future_series primary_id, it will be assumed that the instrument expires on the first of the month (i.e. if the expires value of an instrument were "2012-03", or if there were no expires value but the suffix_id were "H12", the value returned would be "2012-03-01"). Note that most non-energy future_series expire after the first of the month indicated by their suffix_id and most energy products expire in the month prior to their suffix_id month.

Value

an expiration Date

Author(s)

Garrett See

See Also

expires.instrument, expires.character, sort_ids

getInstrument and buildHierarchy to see actual values stored in instrument

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
instr <- instrument("FOO_U1", currency=currency("USD"), multiplier=1,
                    expires=c("2001-09-01", "2011-09-01", "2021-09-01"),
                    assign_i=FALSE)
#Last value of expires that's not after Sys.Date
expires(instr)
# First value of expires that hasn't already passed.
expires(instr, expired=FALSE)
# last value that's not after 2011-01-01
expires(instr, Date="2011-01-01")
# first value that's not before 2011-01-01
expires(instr, Date="2011-01-01", expired=FALSE)

## expires.character
expires("FOO_U1") # warning that FOO_U1 is not defined
instrument("FOO_U1", currency=currency("USD"), multiplier=1,
           expires=c("2001-09-01", "2011-09-01", "2021-09-01"),
           assign_i=TRUE)
expires("FOO_U1")

## End(Not run)

pdrano/FinancialInstrument documentation built on May 6, 2019, 10:51 p.m.