[Returnanalytics-commits] r3185 - pkg/PortfolioAnalytics/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Sep 25 05:01:13 CEST 2013
Author: rossbennett34
Date: 2013-09-25 05:01:12 +0200 (Wed, 25 Sep 2013)
New Revision: 3185
Modified:
pkg/PortfolioAnalytics/R/optimize.portfolio.R
Log:
Adding message to optimize.portfolio for random and DEoptim if min_sum and max_sum are too restrictive.
Modified: pkg/PortfolioAnalytics/R/optimize.portfolio.R
===================================================================
--- pkg/PortfolioAnalytics/R/optimize.portfolio.R 2013-09-24 17:05:52 UTC (rev 3184)
+++ pkg/PortfolioAnalytics/R/optimize.portfolio.R 2013-09-25 03:01:12 UTC (rev 3185)
@@ -610,6 +610,12 @@
upper <- constraints$max
lower <- constraints$min
+ # issue message if min_sum and max_sum are restrictive
+ if((constraints$max_sum - constraints$min_sum) < 0.02){
+ message("Leverage constraint min_sum and max_sum are restrictive,
+ consider relaxing. e.g. 'full_investment' constraint should be min_sum=0.99 and max_sum=1.01")
+ }
+
if(hasArg(rpseed)){
seed <- match.call(expand.dots=TRUE)$rpseed
DEcformals$initialpop <- seed
@@ -656,6 +662,12 @@
# case for random portfolios optimization method
if(optimize_method=="random"){
+ # issue message if min_sum and max_sum are too restrictive
+ if((constraints$max_sum - constraints$min_sum) < 0.02){
+ message("Leverage constraint min_sum and max_sum are restrictive,
+ consider relaxing. e.g. 'full_investment' constraint should be min_sum=0.99 and max_sum=1.01")
+ }
+
#' call random_portfolios() with portfolio and search_size to create matrix of portfolios
if(missing(rp) | is.null(rp)){
if(hasArg(rp_method)) rp_method=match.call(expand.dots=TRUE)$rp_method else rp_method="sample"
More information about the Returnanalytics-commits
mailing list