Description Usage Arguments Details Value See Also Examples
View source: R/getSpreadDividends.R
Get Spread Dividends
1 2 | getSpreadDividends(spread_id, from = "2007-01-01",
to = Sys.Date(), auto.assign = TRUE, env = .GlobalEnv)
|
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 |
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.
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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.