PortfolioAnalytics (version 1.1.0)

portfolio.spec: 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, 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.

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.

Value

an object of class portfolio

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

See Also

add.constraint, add.objective, optimize.portfolio

Examples

Run this code
# NOT RUN {
data(edhec)
pspec <- portfolio.spec(assets=colnames(edhec))
pspec <- portfolio.spec(assets=10, weight_seq=generatesequence())
# }

Run the code above in your browser using DataLab