Results and basic principles
Today’s market of the DeFi indexes offers a high number of investment solutions and platforms, allowing to invest in portfolios composed of various crypto assets.
No matter how well-equipped and sophisticated the product is, the fundamental feature every investment portfolio needs to stay profitable for the investor is a proper rebalancing structure.
As we outlined in our previous articles, currently, similar index solutions, in most cases, offer manual methods of portfolio rebalancing, which also entail a lack of frequency and therefore lead to increased transaction fees and slippage.
This article aims at showcasing the test results of the Merged Finance core feature — our automated Smart Rebalancing System.
But first, let’s get a quick look at the current solutions. Manual rebalancing, which is applied by a vast majority of DeFi indexed platforms and protocols, potentially creates a negative effect on investors: portfolios are balanced manually once a month, which causes a constant imbalance of an index given the high volatility of crypto assets. Manual rebalancing also tends to increase slippage costs: the high volume of concurrent exchanges during every rebalancing increases slippage and leads to a negative impact on potential profit.
Another way of portfolio rebalancing is using Balancer pools for portfolio creation, rebalancing, and management. However, with this method, most of the profits generated by the assets are taken by arbitrageurs who operate Balancer pools, and impermanent losses due to arbitrage.
We equipped Merged Finance with a more reliable rebalancing solution, which rebalances the index at every mint and burn and, therefore, significantly reduces gas fees, maintains the diversification of assets, and minimizes potential slippage.
We will examine manual rebalancing techniques and compare the results to Smart Rebalancing of Merged Finance (using an abstract example).
As displayed on the image, we have an index composed of $AAVE and $BNB in the 30/70 ratio. The surge in the $BNB price changes the assets ratio, which now became 25/75 $AAVE/$BNB.
Let us suppose a user is minting the index amounting to $100 using regular index issue, which leads to purchasing the assets in the current proportion of $25 $AAVE and $75 $BNB. As a result the index remains imbalanced until the next rebalancing, which usually occurs once in 1–2 months.
Manual rebalancing causes tokens to swap during every rebalancing event to restore the initial, correct proportion: tokens which share is greater than the initial rate was, swap to tokens which share is lesser.
By contrast, Smart Rebalancing System allows to check the current proportion of comprising assets before minting an index and purchase the correct share of plunging assets.
For our case example, the balance is achieved by obtaining more $AAVE, which leads to a rational proportion of 30/69.2: now the initial ratio is restored almost entirely.
In summary:
- Smart Rebalancing System helps to reduce gas costs significantly as we execute transactions to mint/burn an index, instead of purchasing every single asset separately;
- Slippage is minimized by a higher frequency of transactions compared to swapping assets occuring once a month
- More profit from regular rebalancing: rebalancing module generates additional revenue from underlying assets and almost entirely covers the swap costs.
In this article, the balancing algorithm for various assets was analyzed on real data from Binance. The analysis was performed for five indexes: ETH, AVAX, BNB, BTC, and MATIC.
The first stage involved the creation of a code for downloading data from the Binance website. In accordance with the analysis of which indexes are necessary to implement, data for the period from 01.03.2021 to 19.03.2022 was uploaded to separate directories.
In the Balancing class, separate modules were organized for combining data, sorting them, a module, that is a programming algorithm, and two modules for implementing the algorithm on the presented data with different buying types: buying obtaining assets and buying all underlying assets according to current proportion.
Let’s balance indexes from the array [‘ETH’, ‘AVAX’, ‘BNB’, ‘BTC’, ‘MATIC’] with a percentage ratio [30, 30, 10, 20, 10] accordingly. TVL = $100 000,00, transaction fee = 5$, base deviation = 10%, transactions per day = 10. The purchase amount is fixed as $10 000 so that it is possible to compare two different implementations of the algorithm.
Smart rebalancing algorithm
The Deviation is the difference between the initial value of an asset and the current value or proportionality of the ratio of tokens within the index in percentage.
The Maximum Deviation is the permissible value of the deviation of an asset of an index. The standard deviation is set manually for the calculation of the maximum deviation. The maximum deviation of each asset is determined as a standard deviation, multiplied by the share of this asset in the pool.
Algorithm of Rebalancing
- Before minting the index the protocol validates the non-exceedance of the maximum allowed deviations
- If the maximum allowed deviation exists, the asset with the maximum deviation is selected and purchased in the amount leading the deviation to its initial value
- In the case of the funds remaining after the purchase is made, the previous action is repeated for the next asset exceeding the maximum deviation value
- If the deviations do not exceed the maximum allowable OR during the points 1.2–1.3 the deviations of all the assets are normalized to the initially established, but the funds still remain, the protocol purchases every comprising asset at the initially established proportions.
First case
In the first case we will check the extreme situation with AVAX underlying assets that changed radically during the entire period, the algorithm wasn’t able to work correctly and rebalance the index to the initial proportion, the results are [25.49% 44.87% 7.01% 15.89% 6.74%]. However, the final TVL is $143 225 423,00, which compared to the monthly rebalancing way is $17 333 212,00 more. When the algorithm has been working as a monthly rebalancing (buying all underlying assets according to current proportion) the final TVL was $125 892 211,00. Tab. 1 shows the data of percentage changes and the final TVL of the indexes in dollars when the algorithm used smart rebalancing. Tab. 2 shows the data of percentage changes and the final TVL of the indexes in dollars when the algorithm has been working as monthly rebalancing.
Working out the algorithm of smart rebalancing for the entire period of analysis Fig. 1 changes in exchange rate, percentage and price for each index during the analysis period
Working out the algorithm with manual rebalancing the entire period of analysis
Fig. 2 changes in exchange rate, percentage and price for each index during the analysis period
Second case
For qualitative comparison, in order to level out the radical changes in AVAX, let’s take the initial percentage ratio between [‘ETH’, ‘BNB’, ‘MATIC’] equals to 30%, 30%, 40%. All other parameters remain unchanged. By analogy with the previous case, Tab. 3 presents data on percentage changes and the final price of indexes in dollars when the algorithm has been working out 10 times a day; Tab. 4 presents data on percentage changes and the final price of indexes in dollars when the algorithm has been working out 10 times a month.
Working out the algorithm of smart rebalancing the entire period of analysis
Fig. 3 change in exchange rate, percentage and price for each index during the analysis period
Working out the algorithm with manual rebalancing the entire period of analysis
Fig. 4 change in exchange rate, percentage and price for each index during the analysis period
Our team had put a lot of resources into testing out our rebalancing using different types of assets; the results show much lesser volatility of indexes rebalanced by the Smart Rebalancing System compared to manual rebalancing methods and an increase in TVL.
However, manual rebalancing can and will complement the Smart Rebalancing of Merged Finance in events of extreme cases, e.g., the first case resulting in asset growth of more than 100%, which is described above. This way will allow us to maximize the potential profit of our users and offer a reliable and complete investment solution.