Standard market methods for optimizing the cryptocurrency portfolio.
For a long time I have been engaged in the formation of portfolios for clients consisting of stocks and ETFs. I stayed away from the cryptocurrency market, as many warned about its unreliability. The same Warren Buffett. But times are changing and I decided to see what’s going on on it. The first task I tried to look at was the prospect of portfolio investment in cryptocurrencies. For analysis, I took cryptocurrencies with maximum capitalization as of December 30, 2020 and for which there is data for at least three years:
At the beginning, I connect the necessary libraries and get data for analysis from yahoo finance.
Next, I will plot the price change of the received cryptocurrencies from 2018 to 2020.
Next, you need to get the percentage change in the value of the asset for the trading day. It is calculated using the pct_change() function from the Pandas package. The profitability indicator allows you to better understand and investigate changes over time. It also allows you to compare different assets with each other.
In order to analyze the dependence, we construct a covariance matrix. It will be needed in the future for the study of portfolios.
After that, you can analyze by generating random weights of each cryptocurrency in the portfolio and calculating profitability and volatility for them. The execution may take a long time.
After that, you can choose a portfolio with minimal volatility, maximum Sharpe ratio and maximum profitability.
We keep for these portfolios the weights that will be required in the analysis in 2021.
We also calculate weights for a portfolio with maximum diversification and store weights for it in a separate variable.
All weights are added to the shared DataFrame.
For a visual representation, we will display pie charts with asset weights in portfolios.
Now comes the most interesting moment — to see how the portfolios behaved in 2021. Let’s carry out the same steps — download the data, calculate their daily profitability.
Then, using the previously obtained weights, we will calculate the profitability of portfolios at the end of the year and their volatility.
We will also plot the price change of portfolios during the year.
As can be seen from the results obtained, the portfolio showed the greatest profitability, which over the past years showed minimal volatility. In second place was a portfolio with maximum diversification. At the same time, all portfolios experienced maximum drawdown from May to June. I would like to warn you, this study is not an investment idea. Moreover, additional analyses using machine learning and time series analysis are still required.
If you need code in Collab, then you can visit my blog and take the code directly from the article: https://alex.gladkikh.org/cryptocurrency/portfolio/2022/05/11/portfolios-cryptocurrency.html