Skip to content
All library documents

Constrained Portfolio Optimization and Ranking Stock Portfolios

Article Quant Q&A · Author: Kuker4e

Summary

The document asks how to identify high-return portfolios from an international stock universe, with each portfolio containing a fixed number of holdings. The proposed constraints include bounds on individual weights, a target range for portfolio standard deviation, long-only positions, and full investment. The response points to the R package PortfolioAnalytics as a tool for specifying constraints and solving portfolio optimization problems.

The answer also highlights a limitation in asking for a ranked list such as the second-highest-return portfolio: with weights taking continuous real values, there may be no straightforward way to define a next-best portfolio without additional rules. The exchange offers brief direction rather than an implementation or an empirical result. It does not explain how to enforce the holding count, estimate returns and risk, handle ties, or prevent overfitting when selecting portfolios using historical data, so reliability depends on choices left unspecified.

Key ideas

  • PortfolioAnalytics is suggested for expressing portfolio constraints and optimizing portfolios in R.
  • The proposed setup includes long-only positions, full investment, weight bounds, and a volatility constraint.
  • With continuous portfolio weights, defining the next-highest-return portfolio may require additional criteria.
  • The document gives no implementation details or evidence that historical rankings will persist.

Tags

Full text
# How to find best-performing portfolios from an universe of stocks


# How to find best-performing portfolios from an universe of stocks












I am a newbie in R.

From an investment universe of around 150 international stocks, I want to find the five best-performing portfolios (each containing 20 stocks) in terms of return for the period 2013-2017 under the constraints: a concrete range for the individual weights, a concrete standard deviation of the portfolio, long only, full investment.

Is it possible to do this reliably and what approach would you recommend? For example, using for loop or some apply function or some approach on portfolio optimization?

I am asking just for a short advice in which direction to go.

Thank you in advance.

## Answer by Andrew (score 2)

https://quant.stackexchange.com/a/37607

Setting your desired constraints and finding the optimal portfolio is all possible with the R package "PortfolioAnalytics".

Unless you have some weird weight constraints (e.g. equally weighted) it is not possible to derive something like the porfolio with the second highest return, since the weights are in $\mathbb{R}$.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.