How to Set Initial Weights for a Portfolio Turnover Constraint
Summary
The document raises a portfolio optimization issue: a turnover constraint with a target of zero appears not to preserve user-specified starting weights. In the example, the author sets four initial asset weights, applies box and return and risk objectives, and uses a random optimization method. The resulting portfolio is equally weighted, which the author identifies as the package’s apparent default starting allocation.
The excerpt contains the question and a reproducible example, but no answer explaining the package behavior or showing how to pass the intended initial weights to the turnover constraint. It therefore illustrates a useful implementation pitfall without resolving it. The observed output is specific to the shown setup; the document does not establish whether the cause is a package default, a configuration issue, or a broader limitation, nor does it provide performance or investment conclusions.
Key ideas
- A zero turnover target is intended to restrict changes relative to initial portfolio weights.
- The example’s optimized weights are equal weighted despite the author specifying a different starting allocation.
- The document does not include a resolution or establish why the configured initial weights are ignored.
- Check how the optimization package receives starting weights when applying turnover constraints.
Tags
Full text
# Turnover Constraint ignores initial weights of Portfolio
# Turnover Constraint ignores initial weights of Portfolio
I am trying to perform a standard portfolio optimization, but with a constraint to how much the final weights of the portfolio are allowed to deviate from a set of initial weights. I do this with the `PortfolioAnalytics` package and the following code is a MWE without any errors.
```
# load packages and data
library(quadprog)
library(PortfolioAnalytics)
data(edhec)
dat <- edhec[,1:4]
# add initial weights to initial portfolio
funds <- c("Convertible Arbitrage" = 0.4, "CTA Global" = 0.3, "Distressed Securities" = 0.2, "Emerging Markets" = 0.1)
init.portf <- portfolio.spec(assets=funds)
# standard constraints & objectives
init.portf <- add.constraint(portfolio=init.portf, type="box", min_w=0, min_sum=0.99, max_sum=1.01)
init.portf <- add.objective(portfolio=init.portf, type="return", name="mean")
init.portf <- add.objective(portfolio=init.portf, type="risk", name="StdDev")
# TURNOVER CONSTRAINT (MATTER OF THIS THREAD)
init.portf <- add.constraint(portfolio=init.portf, type="turnover", turnover_target=0)
# optimize portfolio
opt.portf <- optimize.portfolio(R=dat, portfolio=init.portf, trace=TRUE, optimize_method="random")
# check the weights of optimized portfolio
print.default(opt.portf$weights)
```
`turnover_target` is `0`, so the output weights should be the same as the input weights `(0.4, 0.3, 0.2, 0.1)` but instead they are equal weighted `(0.25, 0.25, 0.25, 0.25)`. Equal weighted are the default initial weights, so somehow it seems like the initial weights I set up aren't recognized. However looking at the documentation of add.constraint or turnover_constraint doesn't help much. It kinda look's like everything should be working. They way I define the initial weights matches with the documentation of portfolio.spec
Does anyone have an idea why my initial weights are ignored by turnover_constraint?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.