From optimal to investable: implementing a portfolio of ETFs, part 1

Portfolio Optimizer
5 min readNov 9, 2020
Photo by Carlos Muza on Unsplash

Note: A Google Sheets spreadsheet corresponding to this story is available here.

Optimal and investable portfolios

As an ETF investor, whether you are lazy or more oriented toward tactical asset allocation strategies¹,you are ultimately faced with the problem of converting an optimal portfolio made of real-valued weights (e.g., 86.42%) into an investable portfolio made of integer-valued ETFs allocations² (e.g. 5 shares).

For example, if you were implementing the Harry Browne Permanent Portfolio strategy using the standard SPY, IEF, GLD and SHY ETFs, you would need to transform the following optimal equal-weighted portfolio into an investable portfolio:

ETFs prices taken at the close of the 6th November 2020

Problem is, given a set of optimal ETFs weights, a set of ETFs prices and an amount to be invested, it might not be possible to implement an investable portfolio as accurately as would optimally be required…

For example, for a Permanent Portfolio of 1,000 USD, and using the ETFs price above, the weight of SPY can only be varied by increments of 350.16/1,000 = 35%.

For such a portfolio, SPY can then represent:

  • 0% of the portfolio (no share)
  • 35% of the portfolio (one share)
  • 70% of the portfolio (two shares)

But it could never represent 25% of the portfolio, although this is the optimal real-valued weight!

What can be done?

Mathematical formulation of the problem

Intuitively, in the example above:

  • Buying no shares of SPY would create a huge difference in the investable portfolio SPY weight v.s. the optimal portfolio SPY weight (0% v.s. 25%), but this difference would allow to buy many shares of the other ETFs, so that their investable weights might be very close to their optimal weights
  • Buying one share of SPY would bring the SPY investable weight closer to its optimal weight (25% is closer to 35% than to 0%) and at the same time would allow to buy some shares of the other ETFs, so that their investable weights might still be close to their optimal weights
  • Buying two shares of SPY would probably not allow to buy enough shares of the other ETFs to have their investable weights close to their optimal weights

So, a compromise needs to be found between buying too much of some ETFs and buying too little of some other ETFs.

This compromise can be formalized as a mathematical optimization problem whose aim is to

compute the investable portfolio which exhibits the minimum deviation³ from the optimal portfolio.

Unfortunately, due to the integer constraints on the number of shares, solving this optimization problem is computationally very challenging: a globally optimal solution might not be unique, might even not exist, and if it does, it might be difficult or extremely time consuming to find it⁴.

Fortunately, several heuristics are available to compute a good enough solution within a reasonable time frame.

Computational solutions

Round-down heuristic

One simple heuristic to compute an investable portfolio from an optimal portfolio is to always round down the optimal fractional number of shares⁵, so that as many shares as possible are bought for each ETF without going above their optimal weights.

Going back to the example of the Permanent Portfolio of 1,000 USD, the associated investable portfolio would be:

The differences between the optimal portfolio weights and the investable portfolio weights would be:

While perfectly working, this heuristic might buy too little of some ETFs (above, no shares for SPY), and might as well leave a lot of cash uninvested in the portfolio (above, about 40% of the portfolio value sits in cash).

Portfolio Optimizer heuristic

A more complex heuristic, using a stochastic optimization algorithm, is provided by Portfolio Optimizer through a Web API.

Going back one last time to the example of the Permanent Portfolio of 1,000 USD, the investable portfolio computed by Portfolio Optimizer would be:

curl "https://api.portfoliooptimizer.io/v1/portfolio/construction/investable"  \
-H "Content-Type: application/json" \
-d '{ "assets": 4,
"assetsPrices": [350.16, 120.5, 183.19, 86.38],
"assetsWeights": [0.25, 0.25, 0.25, 0.25],
"portfolioValue": 1000 }'
{
"assetsPositions":[1,2,1,2],
"assetsWeights":[0.35016,0.241,0.18319,0.17276]
}
  • Through Google Sheets
Example of investable portfolio computed by Portfolio Optimizer and integrated in Google Sheets, for a Permanent Portfolio of 1,000 USD

The differences between the optimal portfolio weights and the investable portfolio weights would be:

Which seem visually better⁶ than the differences obtained with the round-down heuristic!

Large portfolios are impacted too

Mathematically, the larger an investable portfolio is, the closer to the optimal portfolio it can be.

For example, for a Permanent Portfolio of 50,000 USD, and using the ETFs price above, an investable portfolio computed by Portfolio Optimizer would be:

With nearly no differences between the optimal portfolio weights and the investable portfolio weights:

Nevertheless, the larger an investable portfolio of ETFs is, the more potential concentration risk it bears.

Portfolio Optimizer can also help with this, so, be sure to check the second part of this series!

[1]: Like the tactical asset allocation strategies provided on the AllocateSmartly website

[2]: Some brokers like Robinhood or Revolut are disrupting the brokerage industry by allowing fractional shares, but most of the classical brokers do not, and some instruments or exchanges might have other requirements anyway, like buying integer multiples of 100 shares (round lots)

[3]: An example of measure of the deviation between two portfolios is the Euclidean distance between the two portfolios real-valued weights

[4]: The computational problem is NP-hard

[5]: Andreas Steiner, Accuracy and Rounding In Portfolio Construction, available at SSRN

[6]: It is also mathematically better, in terms of Euclidean distance between the two portfolios

Disclaimer

Under no circumstances does any information on this story represent a recommendation to buy, sell, or hold any security.

None of the content of this story is guaranteed to be correct, and anything shown should be subject to independent verification.

You, and you alone, are solely responsible for any investment decisions that you make.

--

--

Portfolio Optimizer

Democratizing the access to the Nobel Prize-winning science of portfolio optimization. Free Web API available at http://portfoliooptimizer.io/