optimize.portfolio.rebalancing: Portfolio Optimization with Rebalancing Periods

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

Description

Portfolio optimization with support for rebalancing periods for out-of-sample testing (i.e. backtesting)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  optimize.portfolio.rebalancing_v1(R, constraints,
    optimize_method = c("DEoptim", "random", "ROI"),
    search_size = 20000, trace = FALSE, ..., rp = NULL,
    rebalance_on = NULL, training_period = NULL,
    trailing_periods = NULL)

  optimize.portfolio.rebalancing(R, portfolio = NULL,
    constraints = NULL, objectives = NULL,
    optimize_method = c("DEoptim", "random", "ROI"),
    search_size = 20000, trace = FALSE, ..., rp = NULL,
    rebalance_on = NULL, training_period = NULL,
    trailing_periods = NULL)

Arguments

R

an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns

portfolio

an object of type "portfolio" specifying the constraints and objectives for the optimization

constraints

default NULL, a list of constraint objects

objectives

default NULL, a list of objective objects

optimize_method

one of "DEoptim", "random", "pso", "GenSA", or "ROI"

search_size

integer, how many portfolios to test, default 20,000

trace

TRUE/FALSE if TRUE will attempt to return additional information on the path or portfolios searched

...

any other passthru parameters to optimize.portfolio

rp

a set of random portfolios passed into the function to prevent recalculation

rebalance_on

character string of period to rebalance on. See endpoints for valid names.

training_period

an integer of the number of periods to use as a training data in the front of the returns data

trailing_periods

an integer with the number of periods to roll over (i.e. width of the moving or rolling window), the default is NULL will run using the returns data from inception

Details

Run portfolio optimization with periodic rebalancing at specified time periods. Running the portfolio optimization with periodic rebalancing can help refine the constraints and objectives by evaluating the out of sample performance of the portfolio based on historical data

This function is a essentially a wrapper around optimize.portfolio and thus the discussion in the Details section of the optimize.portfolio help file is valid here as well.

This function is massively parallel and requires the 'foreach' package. It is suggested to register a parallel backend.

Value

a list containing the following elements

Author(s)

Kris Boudt, Peter Carl, Brian G. Peterson

See Also

portfolio.spec optimize.portfolio

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
data(edhec)
R <- edhec[,1:4]
funds <- colnames(R)

portf <- portfolio.spec(funds)
portf <- add.constraint(portf, type="full_investment")
portf <- add.constraint(portf, type="long_only")
portf <- add.objective(portf, type="risk", name="StdDev")

# Quarterly rebalancing with 5 year training period
bt.opt1 <- optimize.portfolio.rebalancing(R, portf,
optimize_method="ROI",
rebalance_on="quarters",
training_period=60)

# Monthly rebalancing with 5 year training period and 4 year trailing (moving window)
bt.opt2 <- optimize.portfolio.rebalancing(R, portf,
optimize_method="ROI",
rebalance_on="months",
training_period=60,
trailing_period=48)

## End(Not run)

R-Finance/PortfolioAnalytics documentation built on May 8, 2019, 4:46 a.m.