series_instrument: Constructors for series contracts

Description Usage Arguments Details Examples

Description

Constructors for series contracts on instruments such as options and futures

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
  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

maturity

String coercible to Date for maturity date of bond series.

callput

Right of option; call or put

strike

Strike price of option

payment_schedule

Not currently being implemented

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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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"))

## End(Not run)

redmode/FinancialInstrument documentation built on May 27, 2019, 4:03 a.m.