portfolio-class {portfolio} | R Documentation |
Class "portfolio"
Description
Class "portfolio" extends class "portfolioBasic" to include price and share information. Price information must be included in the supplementary "data" slot.
Objects from the Class
Objects can be created by calls of the form new("portfolio", ...)
.
Slots
equity
:Object of class
"numeric"
containing the equity for this portfolio.efile
:Object of class
"character"
containing the file from which this portfolio was loaded, if applicable.price.var
:Object of class
"character"
containing the name of the column in the "data" slot to be used in share and weight calculations.shares
:Object of class
"data.frame"
containing a data frame of shares for each position. Must have a unique column called "id".name
:Object of class
"character"
containing the name for this portfolio.instant
:Object of class
"ANY"
containing the instant to which the portfolio pertains.data
:Object of class
"data.frame"
containing supplementary information about the positions in this portfolio. Must include a unique "id" column.id.var
:Object of class
"character"
containing the name of the column in thedata
slot to be used as a unique identifier.symbol.var
:Object of class
"character"
containing the name of the column in the "data" slot to be used as a descriptive symbol.in.var
:Object of class
"character"
containing the name of the column in the "data" slot to be used as a rank vector in calls tocreate
.weight.var
:Object of class
"character"
containing the name of the column in the "data" slot to be used as weight overrides in calls tocreate
.weight.style
:Object of class
"character"
specifying how to calculate weights in this portfolio. Valid entries are:-
"sides.separate"
: The default. Calculate weight of a position with respect to the total market value of positions on the same side. -
"long.tmv"
: Calculate weight of a position with respect to the total market value of long positions. -
"short.tmv"
: Calculate weight of a position with respect to the (positive) total market value of short positions. -
"reference.equity"
: Calculate weight of a position relative to the reference equity in theequity
slot. Theequity
slot must contain a numeric vector of length 1 for this style.
-
ret.var
:Object of class
"character"
containing the name of the column in the "data" slot to be used as the return in calls toperformance
.type
:Object of class
"character"
containing the type of weight formation to use in calls tocreate
. May be one of "relative", "equal", "linear", "sigmoid", "centroid", or "complex". Defaults toequal
.size
:Object of class
"characterOrNumeric"
containing the size of the portfolio to use in calls tocreate
. May either contain the number of securities per side or one of "decile", "quintile", "quartile", "tercile", or "demile". Defaults toquintile
.weights
:Object of class
"data.frame"
containing the data frame of weights for this portfolio's positions. Must contain a unique column called "id".
Extends
Class "portfolioBasic"
, directly.
Methods
- +
signature(e1 = "portfolio", e2 = "portfolio")
- all.equal
signature(target = "portfolio", current = "portfolio")
: Compare twoportfolio
objects for "near equality". Twoportfolio
objects areall.equal
iff they areall.equal
asportfolioBasic
objects, theirshares
slots contain exactly the same set of securities and shares vectors that areall.equal
.- calcShares
signature(object = "portfolio")
: calculate shares from price and weight information, and store the results in theshares
slot.- calcWeights
signature(object = "portfolio")
: calculate weights from share and price information, and store the results in theweights
slot.- create
signature(object = "portfolio")
: create a portfolio object in the same manner asportfolioBasic
, but also compute share amounts.- expandData
signature(object = "portfolio")
: ...- expose
signature(object = "portfolio", trades = "trades")
: ...- getYahooData
signature(object = "portfolio", symbol.var = "character")
: ...- performance
signature(object = "portfolio")
: ...- securityInfo
signature(object = "portfolio", id = "character")
: display information about positionid
within this portfolio.- getYahooData
signature(object = "portfolio", symbol.var = "character")
: Returns data for P/E Ratio, Book Value, Market Cap, Price/Book, and Price/Sales.- updatePrices
signature(object = "portfolio", id = "character", price = "numeric")
: ...
Author(s)
Jeff Enos jeff@kanecap.com