Sortino<\/a> ratio instead of the Sharpe ratio. The Sortino ratio differs from the Sharpe ratio in that it only divides by downward deviations from the benchmark, so it doesn’t penalize upward movements in a stock.<\/p>\n\n\n\nLet’s change the code to maximize the Sortino ratio:<\/p>\n\n\n\n
def portfolio_annualised_performance(weights, mean_returns, cov_matrix, ctable, bench):\n #sortino\n p_returns = np.dot(ctable,weights)\n p_returns = p_returns[1:]\n bench = bench[1:]\n sp_returns = [0] * len(p_returns)\n \n for i in range(0,len(p_returns)):\n sp_returns[i] = ((p_returns[i] - bench[i]) if (p_returns[i] - bench[i] < 0) else 0)\n \n avg_return = np.mean(p_returns)\n std = np.std(sp_returns)\n return std*np.sqrt(252), avg_return*252\n\ndef neg_sharpe_ratio(weights, mean_returns, cov_matrix, risk_free_rate, ctable, bench):\n p_var, p_ret = portfolio_annualised_performance(weights, mean_returns, cov_matrix, ctable, bench)\n return -(p_ret - risk_free_rate) \/ p_var\n\ndef max_sharpe_ratio(mean_returns, cov_matrix, risk_free_rate, ctable, bench):\n num_assets = len(mean_returns)\n args = (mean_returns, cov_matrix, risk_free_rate, ctable, bench)\n constraints = ({'type': 'eq', 'fun': lambda x: np.sum(x) - 1})\n bound = (0.0,1.0)\n bounds = tuple(bound for asset in range(num_assets))\n result = sco.minimize(neg_sharpe_ratio, num_assets*[1.\/num_assets,], args=args,\n method='SLSQP', bounds=bounds, constraints=constraints)\n return result\n\ndef display_ef_with_selected(mean_returns, cov_matrix, risk_free_rate, ctable, bench):\n max_sharpe = max_sharpe_ratio(mean_returns, cov_matrix, risk_free_rate, ctable, bench)\n\n sdp, rp = portfolio_annualised_performance(max_sharpe['x'], mean_returns, cov_matrix, ctable, bench)\n max_sharpe_allocation = pd.DataFrame(max_sharpe.x,index=ctable.columns,columns=['allocation'])\n max_sharpe_allocation.allocation = [round(i*100,2)for i in max_sharpe_allocation.allocation]\n max_sharpe_allocation = max_sharpe_allocation.T\n return max_sharpe_allocation\n<\/pre>\n\n\n\nAnd we change OptimizedMegacapAlgo<\/em> to pass in the benchmark. Since we are comparing the efficient portfolio to alternatives, let’s use the equal weighted portfolio as the benchmark.<\/p>\n\n\n\nAnd here are the results:<\/p>\n\n\n\n
Stat Efficient Equal Random Market Cap SPY QQQ\n------------------- ----------- ---------- ---------- ------------ ---------- ----------\nStart 2015-02-01 2015-02-01 2015-02-01 2015-02-01 2015-02-01 2015-02-01\nEnd 2021-05-28 2021-05-28 2021-05-28 2021-05-28 2021-05-28 2021-05-28\nRisk-free rate 0.00% 0.00% 0.00% 0.00% 0.00% 0.00%\n\nTotal Return 145.49% 114.13% 114.79% 144.24% 134.76% 246.10%\nDaily Sharpe 0.86 0.77 0.76 0.86 0.84 1.02\nDaily Sortino 1.30 1.15 1.15 1.30 1.25 1.58\nCAGR 15.27% 12.81% 12.86% 15.18% 14.46% 21.71%\nMax Drawdown -30.55% -32.16% -31.87% -30.40% -33.70% -28.56%\nCalmar Ratio 0.50 0.40 0.40 0.50 0.43 0.76\n\nMTD -0.21% 1.78% 1.76% -0.20% 0.66% -1.20%\n3m 9.49% 10.96% 11.20% 9.50% 10.79% 6.43%\n6m 13.74% 15.20% 16.65% 13.72% 16.38% 12.02%\nYTD 9.19% 11.41% 12.31% 9.20% 12.71% 6.57%\n1Y 39.65% 37.42% 41.00% 39.32% 40.88% 46.10%\n3Y (ann.) 20.09% 16.51% 16.87% 19.96% 18.20% 26.49%\n5Y (ann.) 18.69% 15.65% 16.16% 18.60% 17.13% 25.90%\n10Y (ann.) - - - - - -\nSince Incep. (ann.) 15.27% 12.81% 12.86% 15.18% 14.46% 21.71%\n\nDaily Sharpe 0.86 0.77 0.76 0.86 0.84 1.02\nDaily Sortino 1.30 1.15 1.15 1.30 1.25 1.58\nDaily Mean (ann.) 15.94% 13.63% 13.72% 15.85% 15.15% 21.96%\nDaily Vol (ann.) 18.58% 17.72% 17.94% 18.53% 18.12% 21.46%\nDaily Skew -0.57 -0.78 -0.74 -0.57 -0.73 -0.54\nDaily Kurt 16.83 19.70 19.75 16.69 17.24 9.58\nBest Day 9.72% 8.83% 9.30% 9.69% 9.06% 8.47%\nWorst Day -11.58% -11.60% -11.67% -11.54% -10.94% -11.98%\n\nMonthly Sharpe 1.06 0.95 0.96 1.05 0.97 1.20\nMonthly Sortino 2.00 1.69 1.71 1.99<\/span> 1.69 2.53\nMonthly Mean (ann.) 15.51% 13.20% 13.23% 15.43% 14.10% 20.44%\nMonthly Vol (ann.) 14.67% 13.93% 13.75% 14.66% 14.59% 16.97%\nMonthly Skew -0.11 -0.30 -0.37 -0.11 -0.40 0.00\nMonthly Kurt 0.85 1.09 1.04 0.85 1.61 0.13\nBest Month 13.38% 11.31% 10.88% 13.37% 12.70% 14.97%\nWorst Month -9.09% -10.39% -10.43% -9.10% -12.46% -8.65%\n\nYearly Sharpe 1.29 1.32 1.17 1.29 1.27 1.10\nYearly Sortino 16.72 9.78 5.21 16.30 8.19 469.77\nYearly Mean 16.53% 14.01% 14.49% 16.44% 15.24% 22.30%\nYearly Vol 12.78% 10.61% 12.43% 12.76% 11.96% 20.29%\nYearly Skew -0.41 -0.67 -0.95 -0.40 -0.60 0.19\nYearly Kurt -1.21 0.78 1.09 -1.19 1.29 -2.39\nBest Year 31.30% 26.92% 27.48% 31.28% 31.22% 48.62%\nWorst Year -2.42% -3.51% -6.82% -2.47% -4.56% -0.12%\n\nAvg. Drawdown -1.72% -1.71% -1.62% -1.64% -1.53% -2.49%\nAvg. Drawdown Days 15.82 18.33 18.54 16.02 15.58 16.94\nAvg. Up Month 3.20% 3.06% 3.06% 3.19% 3.03% 4.45%\nAvg. Down Month -3.95% -3.61% -3.61% -3.96% -3.93% -3.47%\nWin Year % 83.33% 83.33% 83.33% 83.33% 83.33% 83.33%\nWin 12m % 93.85% 93.85% 92.31% 93.85% 92.31% 92.31%<\/code><\/pre>\n\n\n\n <\/figure>\n\n\n\nStat Efficient Equal Random Market Cap SPY QQQ\n------------------- ----------- ---------- ---------- ------------ ---------- ----------\nStart 2015-02-01 2015-02-01 2015-02-01 2015-02-01 2015-02-01 2015-02-01\nEnd 2015-12-31 2015-12-31 2015-12-31 2015-12-31 2015-12-31 2015-12-31\nRisk-free rate 0.00% 0.00% 0.00% 0.00% 0.00% 0.00%\n\nTotal Return 1.01% -0.12% 0.85% 1.20% 3.07% 10.81%\nDaily Sharpe 0.15 0.07 0.14 0.16 0.29 0.72\nDaily Sortino 0.24 0.11 0.22 0.26 0.47 1.17\nCAGR 1.11% -0.13% 0.93% 1.31% 3.37% 11.92%\nMax Drawdown -13.39% -12.79% -12.34% -13.40% -11.91% -13.94%\nCalmar Ratio 0.08 -0.01 0.08 0.10 0.28 0.85\n\nMTD -1.03% -0.72% -0.42% -1.00% -1.72% -1.59%\n3m 8.89% 8.14% 8.53% 8.93% 7.03% 10.29%\n6m 2.79% 1.58% 2.70% 2.83% 0.16% 5.06%\nYTD 1.01% -0.12% 0.85% 1.20% 3.07% 10.81%\n1Y - - - - - -\n3Y (ann.) - - - - - -\n5Y (ann.) - - - - - -\n10Y (ann.) - - - - - -\nSince Incep. (ann.) 1.11% -0.13% 0.93% 1.31% 3.37% 11.92%\n\nDaily Sharpe 0.15 0.07 0.14 0.16 0.29 0.72\nDaily Sortino 0.24 0.11 0.22 0.26 0.47 1.17\nDaily Mean (ann.) 2.31% 1.03% 2.08% 2.50% 4.44% 12.73%\nDaily Vol (ann.) 15.60% 15.27% 15.29% 15.56% 15.27% 17.79%\nDaily Skew -0.13 -0.21 -0.15 -0.13 -0.28 -0.12\nDaily Kurt 2.92 2.60 2.44 2.93 2.62 2.90\nBest Day 4.26% 3.86% 3.90% 4.26% 3.84% 5.04%\nWorst Day -3.93% -4.01% -3.86% -3.92% -4.21% -4.37%\n\nMonthly Sharpe 0.15 0.05 0.13 0.16 -0.05 0.37\nMonthly Sortino 0.30 0.10 0.25 0.33 <\/span> -0.10 0.84\nMonthly Mean (ann.) 2.17% 0.77% 1.84% 2.38% -0.67% 6.30%\nMonthly Vol (ann.) 14.73% 14.36% 13.65% 14.67% 13.33% 17.23%\nMonthly Skew 0.75 0.60 0.40 0.75 0.96 0.99\nMonthly Kurt 1.71 1.57 1.26 1.70 2.43 1.85\nBest Month 9.23% 8.68% 8.06% 9.21% 8.51% 11.39%\nWorst Month -6.62% -6.83% -6.58% -6.57% -6.10% -6.82%\n\nYearly Sharpe - - - - - -\nYearly Sortino - - - - - -\nYearly Mean - - - - - -\nYearly Vol - - - - - -\nYearly Skew - - - - - -\nYearly Kurt - - - - - -\nBest Year - - - - - -\nWorst Year - - - - - -\n\nAvg. Drawdown -3.48% -3.40% -3.39% -3.47% -2.27% -3.13%\nAvg. Drawdown Days 36.25 41.57 32.33 36.25 30.10 22.77\nAvg. Up Month 3.26% 3.02% 3.02% 3.26% 2.68% 4.15%\nAvg. Down Month -2.89% -2.89% -2.72% -2.87% -2.79% -3.10%\nWin Year % - - - - - -\nWin 12m % - - - - - -<\/code><\/pre>\n\n\n\nAgain, the efficient portfolio allocation is not always the best, but it does tend to perform pretty well. That said, the market-cap weighted portfolio almost always outperforms it.<\/p>\n\n\n\n
Conclusion: do efficient portfolios outperform alternatives?<\/h2>\n\n\n\n From the results we can see that efficient portfolios do perform relatively well, but you will always do just as well or better with a market-cap weighted portfolio.<\/p>\n\n\n\n
tl;dr:<\/p>\n\n\n\n
Does a CAPM optimized efficient portfolio outperform a market-cap weighted portfolio? No, in general you’re likely to do just as well or better with a market-cap weighted portfolio. It doesn’t seem to make sense to optimize a portfolio beyond using a market-cap weighted.<\/em><\/li>Does a CAPM optimized efficient portfolio outperform a randomly weighted portfolio? Yes, in general it does.<\/em><\/li>Does a CAPM optimized efficient portfolio outperform an equally weighted portfolio? Yes, in general it does. <\/em><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"Is Modern Portfolio Theory still relevant today? We compare the returns of an efficient portfolio to random ones to find out.<\/p>\n","protected":false},"author":1,"featured_media":891,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[26],"tags":[28,27,13,29,30,4],"_links":{"self":[{"href":"https:\/\/firemymoneymanager.com\/wp-json\/wp\/v2\/posts\/829"}],"collection":[{"href":"https:\/\/firemymoneymanager.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/firemymoneymanager.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/firemymoneymanager.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/firemymoneymanager.com\/wp-json\/wp\/v2\/comments?post=829"}],"version-history":[{"count":1,"href":"https:\/\/firemymoneymanager.com\/wp-json\/wp\/v2\/posts\/829\/revisions"}],"predecessor-version":[{"id":1195,"href":"https:\/\/firemymoneymanager.com\/wp-json\/wp\/v2\/posts\/829\/revisions\/1195"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/firemymoneymanager.com\/wp-json\/wp\/v2\/media\/891"}],"wp:attachment":[{"href":"https:\/\/firemymoneymanager.com\/wp-json\/wp\/v2\/media?parent=829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/firemymoneymanager.com\/wp-json\/wp\/v2\/categories?post=829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/firemymoneymanager.com\/wp-json\/wp\/v2\/tags?post=829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}