# Crypto Portfolio Optimization Part 2: Pareto Optimization

In this article I will continue on crypto portfolio optimization. This time, return and risk are considered simulatenously which leads us to a Pareto optimization problem. In the following we are going to apply that to cryptocurrencies with the largest market capitalization.

**Additional disclaimer: This is no investment advice or encouragement to buy Crypto. Please, do your own research before investing. This tutorial is only for educational purposes and therefore meant to explain simulation concepts using Python. Furthermore, all mentioned cryptocurrencies are just for illustrative purposes.**

### Portfolio Optimization

In the last article I was talking about correlation coefficients for crypto portfolio optimization.

This time we are going to consider the return and the volatility simultaneously. This means, we try to maximize the return while minimizing the volatility.

Therefore, this leads to an multicriteria optimization or Pareto optimization since we have 2 objectives: **return**, **volatility**. Sometimes, this is also called Markowitz portfolio optimization.

### Pareto Optimization

Pareto optimization is an area of mathematical optimization problems, were more than one objective function is optimized simultaneously.

The result of this optimization process is usually a Pareto optimal solutions. These solutions are located on a so called Pareto frontier (efficient frontier). This means, these solutions can not be dominated by other solutions.

### Sortino ratio

In the following we are using indicators in order to compare different portfolios.

The Sortino ratio is an indicator that calculates the risk adjusted return. Hence, we can examine the performance of an investment. Additionally, we can compare different portfolios with different asset allocations relatively to each other.

Here we assume, that the risk free rate is 0 %. This means there is no such thing as a risk free rate in the crypto space.

### Sampling the Input Portfolios

In order to run the simulations, we need various portfolios with different coin allocations. Furthermore, the sum of all percentages of coins needs to be 1.

(1)

As an example, let us consider 3 different coins (A, B, C). Hence, one possible portfolio could be A = 0.2, B = 0.3, C = 0.5 and another one A = 0.333, B = 0.333, C = 0.333. Therefore, we need to sample all or at least most of the possible portfolios. Hence, this leads us to a Dirichlet distribution. For 3 different coins we need around 2000 portfolios to sample the entire space.

In case you add more coins you increase the dimension of the input space. Therefore, you need way more data points to sample the entire space. This needs to be done carefully, since we don’t want to neglect relevant portfolio distributions.

In my experience so far you would need around 2000 portfolio samples for 3 crypto assets, while you would need around 20000 portfolio samples for 4 crypto assets. The non-linear growth of the sampling point is due to the fact, that you increase the dimensionality with every asset. Therefore, you need way more sample points.

Furthermore, this can be improved using better sampling techniques e.g. Latin hypercube.

### Assumptions for the Portfolio Simulation

- The simulations are conducted on the 28.07.2018.
- In the following we consider the exchange
**Kraken**. - We consider all prices in the fiat-currency:
**EUR** - The example portfolios consist of: BTC, ETH, XRP, BCH. At the time of the simulation they represent the 4 cryptocurrencies with the largest market capitalization.
- We use various timeframes for the simulations: 350, 180, 90 past days.
- We simulate 20000 portfolios for every timeframe.

### Portfolio Simulation Strategy

- First, the input: numberPortfolio, timeframe, Coins, Exchange, currency
- Receive the historical price data
- Create (random) portfolios with a different coin allocation.
- Calculate return, volatility, Sortino ratio for every portfolio.
- Find Pareto frontier.
- Prepare and plot data.
- Repeat the simulations for different timeframes.

### Python

You can view and download the entire Python code in this Github repository.

### Simulation Results

In the following I am going to present the results of the simulations.

- The Pareto frontier is the red line.
- The Sortino ratio is displayed on the color bar.
- The red dot is the portfolio with the maximal Sortino ratio.
- The green dot is the portfolio with the minimal volatility.

#### Portfolio Samples and Pareto Front past 350 days

The return of the simulated 20000 Portfolios are plotted over the volatility which represents the risk. For instance a return of 1 would mean a return of 100 % while a volatiliy of 1 would mean, that the portfolio could fluctuate by 100 %.

Furthermore, the red line represents the Pareto front. This means, the portfolios on this line can not be dominated by another portfolio. Hence, by increasing the potential return, you would need to increase the volatility too.

**From a volatility of around 1.35 (135 %) there are not enough portfolios (data points) around the Pareto front. Therefore, I would neglect the data behind 1.35.**

Usually, you would want to increase the return while decreasing the volatility.

#### Portfolio Samples and Pareto Front past 180 days

This result looks very different, in contrast to the first one, there is no real Pareto frontier. The red dot is very close to the green one. Hence, the portfolio with the maximal Sortino ratio is very close to the portfolio with the minimal volatility. Furthermore, the return of the portfolio is negative. This means by holding these assets (without active trading) you would have made a loss during this period in time.

#### Portfolio Samples and Pareto Front past 90 days

Again, there is no real Pareto frontier and the red dot is very close to the green one. Furthermore, the observations from the 180 days timeframe apply. Within this time period, the negative return and the volatility were a bit lower. Still, there was no portfolio allocation which prevented a loss (with respect to the average return).

Now let us have a detailed look at the portfolios which are represented by the red and green dot.

#### Simulation Results past 350 days

Legend: blue = BTC (Bitcoin), orange = ETH (Ethereum), green = XRP (Ripple), red = BCH (Bitcoin Cash)

The simulation for the past 350 days show a positive Sortino ratio and minimal volatility.

#### Simulation Results past 180 days

#### Simulation Results past 90 days

Furthermore, the simulation for the past 180 and 90 days show negative Sortino ratios and volatility.

Since we are having a look at the cryptocurrency with the largest market capitalization this is an indicator for a bear market.

The allocation of the max. Sortino ratio and min. volatility is similar in the last 180 and 90 days simulation. This can be an indicator that Bitcoin delivered the least negative return with the least negative return.

#### Simulation Results past 350 days – Pareto portfolios in detail

Last but no least, we will have a detailed look at some portfolios on the Pareto frontier of the 350 days simulation from above.

First, I will choose the following 9 representative portfolios on the Pareto frontier.

Afterwards, we are going to illustrate the asset allocation of the 9 portfolios in a stacked barplot.

As you can see, the volatility was increasing with a decreasing amount of BTC. Furthermore, the admixture of XRP and BCH lead to a higher potential return in the past 350 days. The same time it increased the volatility.

In any case the volatility was very high (between 91 – 134 %). Furthermore, the potential return was also high (70 – 97 %).

**Warning: this can look totally different, when applying a different timeframe, different assets or in case you choose an inappropriate number of portfolios.**

### Conclusion

- You can use Pareto optimization as a basis for decision making.
- The final goal is to maximize return and minimize volatility. Therefore, you have a multicriteria optimization (Pareto optimization).
- You can use the Sortino ratio as a indicator to compare portfolios relative to each other.
- Be careful, the results depend strongly on the input timeframe.
- Legthening the timeframe lowers usually the volatility.
- Be careful with the amounts of sample points in case you increase the amount of assets. If you do not know exactly what you are doing, more is better. Furthermore, run various simulations with a different amount of portfolios to see the big picture.
**Past performance does not indicate future results.**

### What do you think?

I’d like to hear what you think about this post.

Let me know by leaving a comment below and don’t forget to subscribe to this blog!