rp_sample: Generate random portfolios using the sample method

View source: R/random_portfolios.R

rp_sampleR Documentation

Generate random portfolios using the sample method

Description

This function generates random portfolios based on an idea by Pat Burns.

Usage

rp_sample(portfolio, permutations, max_permutations = 200)

Arguments

portfolio

an object of type "portfolio" specifying the constraints for the optimization, see portfolio.spec

permutations

integer: number of unique constrained random portfolios to generate

max_permutations

integer: maximum number of iterations to try for a valid portfolio, default 200

Details

The 'sample' method to generate random portfolios is based on an idea pioneerd by Pat Burns. This is the most flexible method, but also the slowest, and can generate portfolios to satisfy leverage, box, group, and position limit constraints.

Value

a matrix of random portfolio weights


braverock/PortfolioAnalytics documentation built on April 18, 2024, 4:09 a.m.