portfolio.spec: constructor for class portfolio

Description Usage Arguments Details Value Author(s) See Also Examples

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

1
2
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.

Details

The portfolio object contains the following elements:

Value

an object of class portfolio

Author(s)

Ross Bennett, Brian G. Peterson

See Also

add.constraint, add.objective, optimize.portfolio

Examples

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

Example output

Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: xts
Loading required package: foreach
Loading required package: PerformanceAnalytics

Attaching package: 'PerformanceAnalytics'

The following object is masked from 'package:graphics':

    legend

PortfolioAnalytics documentation built on May 1, 2019, 10:56 p.m.