portfolioHistory-class {portfolio}R Documentation

Class "portfolioHistory"

Description

Perform exposure, performance, and contribution analysis on all of the portfolioBasic objects that have been added to this object with the add method.

Objects from the Class

Objects can be created by calls of the form new("portfolioHistory", ...).

Slots

name:
Object of class "character" containing the name of this object.
freq:
Object of class "numeric" containing the frequency to be used in annualization calculations, as periods per year. Defaults to 1.
exp.var:
Object of class "character" containing the vector of exposure variables to compute.
exposures:
Object of class "list" containing a list of exposure objects, one for each added portfolio.
ret:
Object of class "list" ~~
ret.detail:
Object of class "list" ~~
contrib.var:
Object of class "character" containing the vector of contribution variables to compute.
contribution:
Object of class "list" containing a list of contribution objects, one for each added portfolio.

Methods

add
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.
contribution
signature(object = "portfolioHistory"): display historical contribution.
exposure
signature(object = "portfolioHistory"): display historical exposure.
performance
signature(object = "portfolioHistory"): display historical performace information.
show
signature(object = "portfolioHistory"): show this object, briefly.
summary
signature(object = "portfolioHistory"): show descriptive information about this portfolioHistory object.

Author(s)

Jeff Enos jeff@kanecap.com

Examples

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)


[Package portfolio version 0.2-1 Index]