portfolio.spec {PortfolioAnalytics}R Documentation

constructor for class portfolio

Description

The portfolio object is created with portfolio.spec. The portfolio object is an S3 object of class 'portfolio' used to hold the initial asset weights, constraints, objectives, and other information about the portfolio. The only required argument to portfolio.spec is assets.

Usage

portfolio.spec(
  assets = NULL,
  name = "portfolio",
  category_labels = NULL,
  weight_seq = NULL,
  message = FALSE
)

Arguments

assets

number of assets, or optionally a named vector of assets specifying seed weights. If seed weights are not specified, an equal weight portfolio will be assumed.

name

give the portfolio a name, the default name will be 'portfolio'

category_labels

character vector to categorize assets by sector, industry, geography, market-cap, currency, etc. Default NULL

weight_seq

seed sequence of weights, see generatesequence Default NULL

message

TRUE/FALSE. The default is message=FALSE. Display messages if TRUE.

Details

The portfolio object contains the following elements:

assets

named vector of the seed weights

category_labels

character vector to categorize the assets by sector, geography, etc.

weight_seq

sequence of weights used by random_portfolios. See generatesequence

constraints

a list of constraints added to the portfolio object with add.constraint

objectives

a list of objectives added to the portfolio object with add.objective

call

the call to portfolio.spec with all of the specified arguments

Value

an object of class portfolio

Author(s)

Ross Bennett, Brian G. Peterson

See Also

add.constraint, add.objective, optimize.portfolio

Examples

data(edhec)
pspec <- portfolio.spec(assets=colnames(edhec))
pspec <- portfolio.spec(assets=10, weight_seq=generatesequence())

[Package PortfolioAnalytics version 2.0.0 Index]