nextExp: Calculate Next Expiration Date For Derivatives

Description Usage Arguments Details Value Note Author(s) References Examples

Description

Used in conjunction with exchange expiration calendars included in the greeks package to find the next expiration date given a set of criteria. Currently only OCC options are available, though this will be user extensible.

Usage

1
2
3
4
5
6
nextExp(n = 1,
        mindays = 0, 
        from = Sys.Date(), 
        cycle = "monthly", 
        calendar = .OCC,
        expiration = TRUE)

Arguments

n

Which expiration or expirations to return, defaulting to n=1 meaning the first 'next' expiry from 'from'.

mindays

Should there be a minimum number of days until expiration? Defaults to zero (no minimum).

from

Next expiration from which date. Must be of class Date or coercible to such.

cycle

Which expiration cycle should be used. Currently only 'monthly' is available.

calendar

Which product calendar should be used. ‘.OCC’ is the only included calendar at the time of release.

expiration

Should the actual expiration be used, e.g. the day following the last trading day for OCC equity options, or should last trading date be returned.

Details

The initial prototype is designed for US equity option expirations as given by the OCC calendar. This is a package variable that is derived from the official OCC sources.

Value

A Date object of length 'n'.

Note

It is always possible that dates change for exchanges or individual contracts. Use your data provider and broker to verify consistency.

Author(s)

Jeffrey A. Ryan

References

http://www.optionsclearing.com/about/publications/expiration-calendar-2011.jsp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
nextExp()

# get next, next cycle
nextExp(n=2)

# change date of calculation
nextExp(from=as.Date("2011-06-02"))

# add minimum number of days to expiry 
nextExp(from=as.Date("2011-06-02"), min=40)

joshuaulrich/greeks documentation built on May 19, 2019, 8:54 p.m.