Markowitz applied to crypto assets

In the article published on alphaquantsearch.com (link), we have defined the optimized unconstrained mean variance portfolio according to Markowitz theory. I have tried to backtest the performance of such a strategy over a 2 year period on 15 cryptocurrencies. Every start of the month, we select a universe of 15 crypto currencies, based on the most traded cryptos over the last 2 months. We pick the means and variances observed on the market over this timeframe as our input for the portfolio construction. The portfolio weight vector at any rebalancing date is a function of the investor expected return for her portfolio. We set this expected return as the return such as the corresponding variance according to the mean variance theoretical function is the mean of volatilities seen in our market universe. Below is the evolution of such a portfolio with a starting value of 1000 USD (blue line) and the corresponding BTCUSD price evolution (red line).

This example emphasize one of the key aspects of this construction: uncontrolled leverage. As our optimisation constraints only set that our sum of weights should be equal to 1 and our portfolio expected return should be equal to the expected return of the investor, individual weights are unbounded with either positive or negative value. As a consequence, even if your portfolio hits 160k USD value in august 2021, it went to 121 USD in November 2020. Bear in mind that you started this strategy with an initial value of 1000 USD so as of this date, you were down 90%. Let us have a look at the portfolio composition around this date:

The portfolio is mainly long 263% of BTCUSDT and short 117% of XRPUSDT. Other weights are importants but less significant. During this timeframe, XRP tripled its value against USD. So why does our theoretical construction find such a big negative weight for XRP ? Well, during the 2 months lookback period we used to estimate our cryptos means and variances, it performed quite negatively compared to other crypto currencies with an important volatility. As a consequence the algorithm set a strong negative number to this asset in its allocation. This is an important aspect of this construction: instability. When there are only small differences in the inputs, especially when assets are highly correlated, portfolio optimisation produces extreme weights. For instance, take a portfolio of 3 assets, all of them with a correlation of 90% to each other. If the three assets have the same expected return but one of them has a higher expected volatility, our portfolio construction will reject it from our allocation. Why? Because it brings the same level of return as the two other assets for a higher risk.

Backtest — Constrained Weights Portfolio

We take the same problem and add the constraint that any weight in our portfolio must be positive. As the sum of weights equal 1, all weights are a a number between 0 and 1. This optimisation problem doesn’t have a closed form, but we can easily find a solution by using a numerical optimizer such as python cvxpy library. It aims at solving any convex function under admitted constraints. Here are the results of such a strategy on the previous 2 years:

This portfolio clearly outperforms BTC during the last two years timeframe. It goes near 20k for the first time in May 2021 and then cross this level around mid November while BTC was near 69k USD. However, the portfolio still has very important drawdowns, more than 50% from beginning of May 2021 to end of July 2021. This is expected as BTC and all major cryptocurrencies suffered the same kind of pullbacks during this period. Below is the composition in may 2021:

The portfolio is mostly a composition of 30.5% ETH, 24.3% BNB, 12.9% FIL and 8.9% VET. BTC was out of this composition as other assets outperformed it earlier in 2021.

Adding the positive constraint on our optimization problem add strong boundaries to each weight (between 0 and 100%) which solved the uncontrolled leverage seen on the previous section. However we can still have an unstable allocation with almost everything allocated to a few assets. This is the case if we take a look at the composition for the month of August 2021:

Almost 83% of the portfolio is allocated to BTC. We still want to build a portfolio with different assets to achieve diversification. As a consequence, we tried another strategy by adding another constraint to the optimisation problem: a maximum weight for each assets. If we have an equally weighted portfolio, each assets has a 1/N weights. We take an arbitrary max bound to 2/N. Here is the backtest result:

The red line is the performance of this strategy. The blue line is the performance of the previous strategy evolution with positive weights bounded to only 100% and the green line is the BTC performance for this timeframe. The additional constraint on the maximum weight for each asset to 2/N seems to improve the performance on the period. Drawdowns are relatively similars in terms of % loss while the max return on the period has been improved in this new strategy with more diversification. Now, we tried to add some leverage to this strategy with a x2 leverage for any positions taken on this red line strategy:

Performances are crazy in a good and bad way. Good because we almost reached 330k USD in May 2021 with a 1000 USD initial investment. Bad because the drawdown following this peak is more than 80%. Note that it bounces back to 250k in November 2021. This is typically the kind of drawdown we saw for the unconstrained construction. Adding leverage to an optimized portfolio seems to be a dangerous game as it amplifies significantly your risk.

Conclusion

In this article, we have shown how to build a theoretical Markowitz portfolio and what are the limits of such a construction. It mostly suffers of instabilities like excessive weight leverage (either positive or negative) and portfolio concentration as it strongly overweights assets with very good risk / returns characteristics and underweights those with deeply negative scores. We have seen how to improve this theoretical construction by using a numerical solver and adding new constrains to each portfolio weights. By adding the rule that each weight must be positive, we have removed the excessive use of leverage in the portfolio optimization, reducing the risk of ruin for the investor. By adding a maximum weight size of 2/N for each asset, we have improved the strategy performance over the previous two years.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store