portfolioHistory-class {portfolio} | R Documentation |
Perform exposure, performance, and contribution analysis
on all of the portfolioBasic
objects that have been added to
this object with the add
method.
Objects can be created by calls of the form new("portfolioHistory", ...)
.
name
:"character"
containing
the name of this object.freq
:"numeric"
containing the
frequency to be used in annualization calculations, as periods per
year. Defaults to 1. exp.var
:"character"
containing
the vector of exposure variables to compute. exposures
:"list"
containing a
list of exposure objects, one for each added portfolio. ret
:"list"
~~ ret.detail
:"list"
~~ contrib.var
:"character"
containing the vector of contribution variables to compute. contribution
:"list"
containing
a list of contribution objects, one for each added portfolio.signature(object = "portfolioHistory", x =
"portfolioBasic")
: add portfolio x
to history object
object
. The history object collects and stores exposure,
contribution, etc. information from portfolio x
upon add. signature(object = "portfolioHistory")
:
display historical contribution. signature(object = "portfolioHistory")
:
display historical exposure. signature(object = "portfolioHistory")
:
display historical performace information. signature(object = "portfolioHistory")
: show
this object, briefly.signature(object = "portfolioHistory")
: show
descriptive information about this portfolioHistory
object.Jeff Enos jeff@kanecap.com
data(global.2004) portfolios <- lapply(split(global.2004, global.2004$date), function(x){ new("portfolioBasic", name = "test", date = as.Date(unique(x$date)), id.var = "symbol", in.var = "cap.bil", ret.var = "ret.0.1.m", type = "sigmoid", size = "quintile", sides = c("long", "short"), data = x) }) h <- new("portfolioHistory", freq = 12, exp.var = c("currency", "sector", "liq.w", "cap.bil"), contrib.var = c("currency", "sector", "liq.w")) for(i in 1:length(portfolios)) h <- add(h, portfolios[[i]]) exposure(h) performance(h) contribution(h)