# 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")
# }
Run the code above in your browser using DataLab