Introducing the MCOS Open Source Package
What is the best portfolio allocation method? It’s an underrated question.
While many investors focus on selecting the right securities to invest in, research has shown that allocating wisely among those securities is just as important, if not more important than selecting the securities themselves.
In pursuit of the best way to allocate portfolios, some brilliant minds have come up with sophisticated mathematical algorithms. Harry Markowitz was the first to do so way back in 1952, ultimately earning him the Nobel Prize. Other researchers followed, sometimes with tweaks to the Markowitz model (e.g. Black Scholes), and at other times with completely different approaches (e.g. Risk Parity).
Given the variety of portfolio allocation algorithms available, investors often ask which one is best. Unfortunately, answering this question is impossible, because there’s no one criteria by which we can judge all algorithms. Some investors may want an algorithm that maximizes the Sharpe Ratio with no regard for any other constraints. Others may want to ensure that their algorithms produce consistent allocations over time, in order to reduce portfolio turnover.
So how can an investor evaluate what the best algorithm is for him/her? This is the question that Dr. Marcos Lopez de Prado addresses with his new framework called the Monte Carlo Optimization Selection (MCOS). The framework is detailed in Dr. de Prado’s publicly available paper.
As an overview, MCOS works as follows. First, we assume that we have the truth regarding each security; for example, we know their expected rates of returns, their volatilities, and their correlations (these last two assumptions are expressed in the covariance matrix in the algorithm).
But of course, the real world is stochastic. Realized returns, volatilities and correlations are different from the ‘true’ values in random fashion. MCOS thus simulates realized performances of each security by perturbing them (i.e. adding or subtracting small random values to the true values).
Next, MCOS creates portfolio allocations using both the true values and the simulated values. We conduct this step for each portfolio allocation algorithm we consider using.
Lastly, MCOS compares the target metrics between the portfolio created using true values, and the portfolios created using simulated values. The target metrics are chosen by the user, and examples include expected outcomes and Sharpe ratios.
Although Dr. de Prado generously shared his MCOS algorithm code in his paper, we felt that the code could be improved by introducing good software engineering practices. Doing so would make it easier for users to extend the algorithm to fit their own unique needs, such as by integrating their own portfolio optimization algorithms, or by creating their own target metrics.
We therefore decided to re-architect the MCOS algorithm and make it publicly available as an open source project. You can access the package right now by going to https://github.com/enjine-com/mcos.
If you want to extend MCOS for your own specific needs, you just need to implement one of the abstract classes found in the package. (If you don’t know what that means, just ask your nearest programmer.)
We hope that this package proves useful in evaluating the different types of portfolio optimization algorithms. We certainly plan on using it ourselves for our own internal projects.