getSpreadDividends: Get Spread Dividends...

Description Usage Arguments Details Value See Also Examples

View source: R/getSpreadDividends.R

Description

Get Spread Dividends

Usage

1
2
  getSpreadDividends(spread_id, from = "2007-01-01",
    to = Sys.Date(), auto.assign = TRUE, env = .GlobalEnv)

Arguments

spread_id

chr primary identifier for an already defined spread instrument

from

Date from which to get dividends

to

get dividends through this date

auto.assign

if TRUE (default), spread dividends will be stored in an environment

env

where to get data. If auto.assign is TRUE it is also where the spread dividends will be stored

Details

Given a spread_id, this will look for dividend data for each of the constituent legs of the spread in the the env specified. If dividend data are not in env a call will be made to getDividends The memberratio (stored in the spread instrument) will be used to weight the dividends. Negative values in ‘memberratio’ indicate short positions. Dividends on short legs will be negative.

Value

if auto.assign is TRUE the output will be written in the env specified with a .div appended to the name, and only the name of the symbol where the dividends were stored will be returned.

otherwise, an xts object containing dividends with negative values indicating payments in leiu of dividends.

See Also

getDividends, spread

Examples

1
2
3
4
5
6
7
## Not run: 
s <- define_stocks(c("SPY","DIA"))
spread('spydia', 'USD', members=s, memberratio=c(1,-1))
getSpreadDividends('spydia')
spydia.div

## End(Not run)

qmao documentation built on May 2, 2019, 4:54 p.m.