Portfolio Analysis with Turnover Constraints

This example shows how to analyze the characteristics of a portfolio of equities, and then compares them with the efficient frontier. This example seeks to answer the question of how much closer can you get to the efficient frontier by only risking a certain percentage of a portfolio to avoid transaction costs.

Import Data for the Portfolio Holdings

Load information on the current portfolio holdings from a Microsoft® Excel® spreadsheet into a table using the MATLAB® readtable function.

AssetHoldingData = readtable('portfolio.xls');
% Create a normalized current holdings vector that shows the respective% investments as a percentage of total capital:
W = AssetHoldingData.Value/sum(AssetHoldingData.Value);

Import Market Data for Share Prices

Import the market data from a data source supported by Datafeed Toolbox™ that constitutes three years of closing prices for the stocks listed in the portfolio.

addpath(fullfile(matlabroot,'examples','finance'));
load SharePrices

Create a Portfolio Object

The Portfolio class enables you to use the imported data to create a Portfolio object. The estimateAssetMoments function for the Portfolio object enables you to set up a portfolio given only a historical price or returns series. The estimateAssetMoments function estimates mean and covariance of asset returns from data even if there is missing data.

Visualize the Transaction Costs and Turnover

Due to transaction costs, it can be expensive to shift holdings from the current portfolio to a portfolio along this efficient frontier. The following custom plot shows that you must turn over between 50% and 75% of the holdings to get to this frontier.

TurnoverPlot(P)

Perform Portfolio Optimization with a Turnover Constraint

How close can you get to this efficient frontier by only trading some of the portfolio? Assume that you want to trade only a certain percentage of the portfolio to avoid too much turnover in your holdings. This requirement imposes some nonlinear constraints on the problem and gives a problem with multiple local minima. Even so, the Portfolio object solves the problem, and you specify the turnover constraint using the setTurnover function.

P10 = setTurnover(P,0.10);
plotFrontier(P10)

Visualize the Efficient Frontier at Different Turnover Thresholds

This efficient frontier is much closer to the initial portfolio than the starting efficient frontier without turnover constraints. To visualize this difference, use the custom function TurnoverConstraintPlot to visualize multiple constrained efficient frontiers at different turnover thresholds.

The Portfolio object is a powerful and efficient tool for performing various portfolio analysis tasks. In addition to turnover constraints, you can also optimize a Portfolio object for transaction costs for buying and selling portfolio assets using the setCosts function.

Open Example

A modified version of this example exists on your system. Do you want to open this version instead?