Introduction
The US government is in the process of creating a Strategic Bitcoin Reserve and a Digital Asset Stockpile. Although the executive order states the government shall not acquire additional Stockpile Assets, this research analyzes various portfolio construction techniques to manage allocations within the Stockpile. We test equal weights, inverse-volatility weights, and hierarchical risk parity (HRP). The results show that HRP produces the greatest Sharpe ratio. However, all the techniques underperform the Strategic Bitcoin Reserve.
Background
The Digital Asset Stockpile (DAS) will contain a portfolio of Cryptocurrencies held and maintained by the government. The US government holds other reserve assets and stockpiles to ensure stability, security, or preparedness. The DAS may share some of these qualities, and some bureaucrats argue it could be a plan to offset the federal debt. The question becomes: What cryptocurrencies will be in the DAS, and how will the portfolio allocations be managed?
Equal-weighted portfolio construction is a straightforward approach to allocation management. It involves allocating an equal amount to all assets in the portfolio during each rebalance. Another traditional portfolio construction technique is inverse-volatility portfolio (IVP) weighting, where each asset receives an allocation proportional to the inverse of its realized volatility.
wi=1σi∑nj=11σj
Hierarchical Risk Parity (HRP) is a portfolio construction technique that uses hierarchical clustering on a correlation matrix to organize assets into a tree. HRP then traverses down the tree, allocating weights at each node to equalize risk between each branch in the tree. For example, the following dendrogram shows the clustering result for the 10 most traded Cryptocurrencies on Coinbase at the time of writing, and the pie chart shows the target portfolio weights.
There are several benefits to HRP. Firstly, traditional quadratic optimizers like Markowitz’s mean-variance optimization (MVO) require the covariance matrix to be invertible. However, HRP doesn’t have this requirement, so it avoids Markowitz’s curse. Markowitz’s curse is the idea that as the number of correlated assets in the portfolio grows, the matrix inversion is prone to large errors, which can more than offset the benefits from the increase in diversification.
Secondly, quadratic optimizers like MVO calculate the portfolio weight to minimize variance on the in-sample dataset, but López de Prado’s (2018) Monte Carlo experiments show that HRP produces lower out-of-sample variance than MVO and IVP.
Thirdly, HRP is more resilient to idiosyncratic and systemic shocks than MVO and IVP. MVO tends to concentrate a large portion of the portfolio on a few assets, and IVP tends to thinly spread the portfolio across many assets. In contrast, HRP balances both approaches by diversifying the portfolio across clusters.
For an in-depth review of the math behind HRP, see López de Prado (2018). To summarize, HRP operates in three stages:
- Tree Clustering:
- Calculate the correlation and covariance matrix from the daily returns of the assets in the universe.
- Apply a distance metric d to each element in the correlation matrix, creating matrix D.
- Calculate the Euclidean distance of each column in D. This results in a new matrix Ëœdi,j that incorporates information from the entire correlation matrix instead of just the correlation between two assets.
- Select the pair of columns u[1] in Ëœdi,j with the lowest sum.
- Calculate the distance ˙di,u[1] between u[1] and the remaining items in ˜di,j.
- Append ˙di,u[1] to ˜di,j and drop the clustered columns and rows j∈u[1].
- Recursively apply the previous three steps until the final cluster contains all the assets.
- Quasi-Diagonalization: Using the tree's structure, reorganize the covariance matrix to put the largest values on the diagonal so that similar investments are closer together.
- Recursive Bisection: Traverse down the tree. At each node in the tree, form an inverse-variance portfolio with the assets in each cluster and calculate each cluster’s portfolio variance. Scale down the weights of the assets in each cluster to balance their risk contribution, giving a larger allocation to the cluster with less volatility.
Implementation
To implement this strategy, we start with the initialize method getting all the Crypto pairs on Coinbase that have a quote currency of USD and aren’t a stablecoin.
self._market_pairs = [
x.key.symbol
for x in self.symbol_properties_database.get_symbol_properties_list(Market.COINBASE)
if (x.value.quote_currency == self.account_currency and # Account currency is USD
x.value.market_ticker.split('-')[0] not in ['DAI', 'USDT', 'USDC']) # Remove stablecoins
]
Next, we add a Crypto universe that updates at the start of each month.
date_rule = self.date_rules.month_start()
self.universe_settings.schedule.on(date_rule)
self.universe_settings.resolution = Resolution.DAILY
self._universe = self.add_universe(CryptoUniverse.coinbase(self._select_assets))
We also add a Scheduled Event to rebalance the portfolio at the start of each month.
self.schedule.on(date_rule, self.time_rules.midnight, self._rebalance)
To end the initialize method, we create an instance of the HeirarchicalRiskParity class. This class definition was sourced from López de Prado (2018) with minor adjustments to incorporate LEAN history requests and Python 3 support.
self._hrp = HeirarchicalRiskParity(self)
The _select_assets universe filter function selects the 10 most traded pairs on Coinbase that have a quote currency of USD and aren’t a stablecoin.
def _select_assets(self, data):
selected = [c for c in data if str(c.symbol.id).split()[0] in self._market_pairs]
return [c.symbol for c in sorted(selected, key=lambda c: c.volume_in_usd)[-10:]]
The _rebalance method simply passes the universe constituents to the HeirarchicalRiskParity object to determine the portfolio weights, then rebalances with the target weights.
def _rebalance(self):
symbols = self._universe.selected
if not symbols:
return
self.set_holdings([PortfolioTarget(symbol, 0.9*weight) for symbol, weight in self._hrp.weights(symbols).items()], True)
To view the HeirarchicalRiskParity class definition, see the attached backtest.
Results
We backtested the equal-weighted, IVP, and HRP algorithms over the last 8 years to approximately align with two Bitcoin halving cycles. The benchmark is buy-and-hold Bitcoin, which produced a 1.157 Sharpe ratio. The portfolio construction techniques produced the following Sharpe ratios:
- Equal Weighted: 0.794
- Inverse-Volatility Weighted: 0.853
- Hierarchical Risk Parity: 0.922
We ran a parameter optimization job to test the sensitivity of the chosen parameters. We tested a universe size of 5 to 25 in steps of 5, and we tested lookback periods between 6 months and 18 months in steps of 3 months. Of the 25 parameter combinations, 0/25 (0%) produced a greater Sharpe ratio than the benchmark. The following image shows the heatmap of Sharpe ratios for the parameter combinations:
The red circle in the preceding image identifies the parameters we chose as the strategy's default. We chose a lookback period of 1 year and a universe size of 10 because it was in the center of an area of the least sensitive parameter combinations.
In conclusion, the portfolio construction techniques we tested for the DAS underperformed a Bitcoin-only approach.
References
- López de Prado, M. (2018). Advances in financial machine learning. Wiley.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!