Portfolio Rebalancing Algorithms In Crypto (Part I)

This article will detail some of the complexities involved with portfolio rebalancing for cryptocurrencies. Theoretically, rebalancing should be simple, but there are complications that arise based on restrictions that are imposed by exchanges. One of these restrictions is that limit orders commonly have minimum trade requirements. These minimums vary between exchanges, but each result in situations where target allocations cannot be reached. This occurs when the trade necessary to reach a target allocation is less than the minimum trade requirement.

The act of buying more of an asset which needs funds to reach its target allocation is called “debt resolution”. The process of selling an asset which performed well over a period and has a larger allocation than the target allocation is considered “taxation”. Taxing the assets which performed well so they match their target allocations is generally easy, paying the debt out to the remaining assets is more complicated. There are cases where debt cannot be paid. Whether this is a result of a taxed asset not meeting the minimum requirements to make a trade or exchange errors, it doesn’t matter. The result is a situation where more debt is owed than what is available to pay.

Unless otherwise specified, each algorithm will assume trades happen through BTC. This means there will be two discrete steps. First, all assets which have a larger percent allocation than their target allocations will be taxed. This taxation happens by selling the asset for BTC. Second, debt will be paid to each asset which has a smaller percent allocation than their target allocation. Payment will be made from the pool of BTC that was collected during the taxation step.

Constructing algorithms to address this issue should meet the 4 following requirements:

Fairness: The fairest instance is not picking between two assets. This means if there are only enough funds to make one trade, the fairest option is to pick neither. (however, this may not be desired from the user standpoint)

Deterministic: The algorithm should be consistent. It should work every single time. Every reachable state should be predictable.

Usability: An algorithm can be fair and deterministic, but not usable. The algorithm needs to be usable and desirable. It should produce results that the user wants to see.

Economical: Any method used shouldn’t require excessive trades to fit one of the previous requirements. The algorithm should optimize for the smallest amount of fees possible.

Share based debt resolution

Share based debt resolution is an algorithm that attempts fairness in results. The way this solution works is by divvying up the shares by calculating the percent debt held by each asset. For example, let’s say the total debt is 100 BTC, however only 90 BTC is available for payment. This means 90 BTC needs to be divided among 100 BTC of debt. The fairest way to do this is to pay out 90% of the debt that is owed to each individual asset. Instead of satisfying 100% of any assets debt, they will only get 90% of their debt paid.

This is the fairest and most deterministic algorithm. No decisions are made that prioritize a single asset or trade. The issues come from usability and economical decisions.

One issue with this solution is that it is rare to be able to pay out 100% of the debt that is owed. Since this is a rare occurrence, it will be rare to have every asset reach its target allocations. As a result, this algorithm may be less desirable for some users who wish to have as many assets reach their target allocations as possible. In the other sense, this algorithm may be more desirable for some users since this technique is completely unbiased. It does not attempt to anticipate which asset the user would prefer to buy.

Largest debt first resolution

The largest debt first resolution algorithm focuses on paying off the largest debt first. The reasoning behind this algorithm is that the assets which have the largest debt are the furthest from their target allocations. In this sense, it makes sense that the algorithm should satisfy the assets which are furthest from the users desired allocations first.

Let’s examine the same situation that was examined above. Imagine you only have 90 BTC but have 100 BTC of debt to pay. With this algorithm, you will pay the assets which are furthest from their target allocation first. This may result in a single asset getting 90 BTC if they are far enough away. Then, there is 0 BTC left to pay the remaining assets.

While this strategy will likely make sense to some users, it is assuming that the user would want the asset with the largest debt to be paid first. This may not be the case. Since it is an unfair algorithm, this results in assumptions that may not be desirable from the user’s prospective.

Path of Least Resistance Debt Resolution

The path of least resistance debt resolution is slightly different than the previous algorithms. This technique is only available for a subset of asset pairs and bypasses the BTC pool that is collected for debt pay out by other assets. The path of least resistance refers to trading pairs that connect assets directly together, so they don’t need to be traded through BTC during a rebalance. An example of one of these pairs is XRP/ETH on Binance. If a portfolio contains both XRP and ETH, it has an opportunity to trade directly between these two assets without first trading to BTC.

The path of least resistance is always considered the path which results in the largest amount of the resulting asset. So, this considers fees, spread, and slippage to maximize the final asset amount. Given the scenario which two assets are present in the portfolio which are also a pair, they can be evaluated and paid off first given they are the path of least resistance.

The path of least resistance debt resolution can further be generalized to include all trades that result in the smallest spread, slippage, and fees. This results in maximizing purchase power of the portfolio for those assets which are considered cheap to acquire.

The resistance can then be calculated for each asset based on the following criteria:

  • # of trades, where higher increases resistance
  • % spread, where higher increases resistance
  • % slippage, where higher increases resistance
  • % fees, where higher increases resistance

Putting it all together

Once these strategies are understood, it’s possible to put them all together to create a rebalancing algorithm which is fair, deterministic, usable, and economical. This is done by performing each of these strategies at different stages.

First, the economical strategy of fulfilling the path of least resistance will be completed. This should be done before any assets have sold to BTC.

Second, the fairest strategy should be used to distribute the BTC that was collected for debt distribution. This allows the spread of debt across all assets which require payment. However, during this process, there may be trades which are smaller than the minimum trade limit if the deviation for some assets are small.

Third, the usable strategy of largest debt first should be used to distribute the BTC which was left over from the previous step. This allows each asset to get as close as possible to the target allocation.

This staged strategy is deterministic which provides a comfort in predictability for how the algorithm will behave during rebalances.

Rebalancing is Complex

On the surface, rebalancing is a simple strategy: realign the current allocations with the target allocations. However, digging into the details surfaces complexities that complicate the way rebalances are performed. This whitepaper attempts to illuminate these complexities and provide a foundation for future research.

Although Shrimpy has a great foundation, we are constantly improve the rebalancing algorithm. We will be integrating the most advanced rebalancing features in the market to ensure our users are constantly at the front of the curve. While the algorithms detailed above are a starting point for your adventures into rebalancing, there are far more complex strategies we will be discussing in future articles.


Don’t forget to check out the Shrimpy website, follow us on Twitter and Facebook for updates, and ask any questions to our amazing, active communities on Telegram & Discord.

The Shrimpy Team

Source: hackernoon.com

Comments

Để lại ý kiến của bạn:

Your email address will not be published. Required fields are marked *