FinancialInstrument (version 1.3.1)

future_series: Constructors for series contracts

Description

Constructors for series contracts on instruments such as options and futures

Usage

future_series(primary_id, root_id = NULL, suffix_id = NULL,
  first_traded = NULL, expires = NULL, identifiers = NULL,
  assign_i = TRUE, overwrite = TRUE, ...)

option_series(primary_id, root_id = NULL, suffix_id = NULL, first_traded = NULL, expires = NULL, callput = c("call", "put"), strike = NULL, identifiers = NULL, assign_i = TRUE, overwrite = TRUE, ...)

bond_series(primary_id, suffix_id, ..., first_traded = NULL, maturity = NULL, identifiers = NULL, payment_schedule = NULL, assign_i = TRUE)

Arguments

primary_id

String describing the unique ID for the instrument. May be a vector for future_series and option_series

root_id

String product code or underlying_id, usually something like 'ES' or 'CL' for futures, or the underlying stock symbol (maybe preceded with a dot) for equity options.

suffix_id

String suffix that should be associated with the series, usually something like 'Z9' or 'Mar10' denoting expiration and year.

first_traded

String coercible to Date for first trading day.

expires

String coercible to Date for expiration date

identifiers

Named list of any other identifiers that should also be stored for this instrument.

assign_i

TRUE/FALSE. Should the instrument be assigned in the .instrument environment?

overwrite

TRUE/FALSE. If FALSE, only first_traded and expires will be updated.

...

any other passthru parameters

callput

Right of option; call or put

strike

Strike price of option

maturity

String coercible to Date for maturity date of bond series.

payment_schedule

Not currently being implemented

Details

The root instrument (e.g. the future or option) must be defined first.

In custom parameters for these series contracts, we have often found it useful to store attributes such as local roll-on and roll-off dates (rolling not on the first_listed or expires.

For future_series and option_series you may either provide a primary_id (or vector of primary_ids), OR both a root_id and suffix_id.

Note that the code for bond and bond_series has not been updated recently and may not support all the features supported for option_series and future_series. Patches welcome.

Examples

Run this code
# NOT RUN {
currency("USD")
future("ES","USD",multiplier=50, tick_size=0.25)
future_series('ES_U1')
future_series(root_id='ES',suffix_id='Z11')
stock('SPY','USD')
option('.SPY','USD',multiplier=100,underlying_id='SPY')
#can use either .SPY or SPY for the root_id. 
#it will find the one that is option specs.
option_series('SPY_110917C125', expires='2011-09-16')
option_series(root_id='SPY',suffix_id='111022P125')
option_series(root_id='.SPY',suffix_id='111119C130')
#multiple series instruments at once.
future_series(c("ES_H12","ES_M12"))
option_series(c("SPY_110917C115","SPY_110917P115"))
# }

Run the code above in your browser using DataLab