237 total views
The use of customized over-the-counter options by large AMM liquidity market makers may be the best risk hedging option at present.
Original title: “AMM market-making impermanence loss hedging analysis series 1: Profit and loss and option hedging model construction”
Authors: Yuan Yuming, Kang Luzhi, Xu Tong, the former is Huobi China CEO and Dean of Huobi Research Institute
Liquid market making is one of the hot spots in the market. Under the Automated Market Maker system, liquid market makers will have impermanent losses in their principal. This article first introduces the AMM market-making mechanism, and deeply analyzes why impermanence losses occur under this mechanism. The main reason is that if the price of unstable assets in the liquidity pool rises or falls under the AMM mechanism, the market maker will completely automatically act in the opposite direction to the general market trader. The higher the price, the more selling, the lower the price, the more buying. Therefore If the price of assets in the pool rises, their quantity will decrease, and if asset prices rise, their quantity will increase. After that, we will focus on analyzing that for a liquidity pool of non-stable currency and stable currency pairs, the AMM mechanism affects liquidity There are four main factors in the market maker’s profit and loss: Gas fees, transaction fees, profit and loss caused by non-stable currency price changes, and impermanent loss, and accurate calculations show the impact of these factors on the LP supplier’s profit and loss. influences. In the end, we merged to derive the comprehensive profit and loss calculation formula for the profit and loss of the non-stable currency-stable currency liquidity supplier under the AMM mechanism with price fluctuations. This formula allows liquid market makers in the market to achieve precise risk control and lays the foundation for the subsequent accurate calculation of hedging products. I hope it will be helpful for you to participate in liquid market making.
We accurately calculated the hedging plan based on the comprehensive profit and loss formula and the derivatives available in the market. Contract products are not suitable for hedging due to the characteristics of linear instruments that cannot cover nonlinear risks well. We found that the theoretically effective hedging scheme is based on the amount of non-stable currency assets in the pledge pool, buying 2 put options and 1 call option. In practice, if you consider cost call options, you can consider taking the initiative to replace them.
There are also certain problems for on-market options products, which are mainly reflected in the lack of coverage of the time period and market depth. Therefore, for large liquidity market makers, customized over-the-counter options products may be the best choice at present.
In addition, we will discuss the comprehensive profit and loss formula and hedging possibility of dual non-stable currencies in a follow-up article.
Recently, many encrypted digital currency investors have seen DeFi projects emerge in an endless stream, and the market seems to be making money, so they can’t help but want to participate. The process is often that the investor immediately consults the relevant information and then finds out with friends, and found that most of the hot projects are to pledge the same amount of two currencies for liquidity market making. Although it is not clear, the website It is written that there are very attractive annual revenues of several hundred percent, and security code audits. The problem should not be big. After a little query, I saw a lot of mining strategies, and found that it seems that after the transfer and pledge, you can get a lot of new tokens, and the tokens can be sold directly to the exchange to make money, so I added liquidity to market making The ranks of the army. However, the world is unpredictable. The price of Ethereum in the pledge pool has dropped sharply, and the price of the governance tokens dug out has also fallen. Investors quickly withdrew the funds from the liquidity pool and found that the proportion of pledged coins had changed. Get more Ethereum with a lower price and less another high-value token. After selling the rewarded tokens, the overall liquidity mining did not reach the hundreds of annualized returns written on the previous web page. The income is pitiful, and you may have lost money, so what is the problem? Is there any way to hedge this loss?
Automatic market maker
It is not difficult to see from the above example that investors are participating in the liquidity mining activities of various projects under the Automated Market Maker (AMM) mechanism designed by Uniswap. At present, many participants do not realize that participating in liquidity market making is not risk-free. On the contrary, as prices fluctuate, market-making funds may experience certain losses. These risks mainly come from the impermanent loss contained in the AMM mechanism.
First introduce the AMM automatic market maker mechanism designed by Uniswap. The core market-making formula of automatic market makers is:
The meaning of this formula is that every time a liquidity provider deposits an asset, the product of the two assets is calculated and kept constant. The deposit ratio is the price of the asset at a certain moment. For example, if the price of ETH is 440 USDT at a certain moment, the market maker needs to deposit 10 ETH and 4400 USDT, the product is 44000. For traders, real-time exchange can exchange 1 ETH from the liquidity pool with 440USDT and Qiansan’s handling fee. Under this mechanism, market makers (liquidity providers/LPs) need to deposit two parts of assets of equal value to obtain dividends in the liquidity pool, including LP Token and corresponding proportional handling fees.
The specific process of AMM self-marketing is demonstrated by the following example.
Assuming that there is a liquidity pool of assets A and B initially, the impact of handling fees is not considered. When the market makers first rushed in 1000 A and 2000 B, then according to the above formula X×Y=K, the constant K can be calculated, which is the product of 2000000. At this time, traders in the market think that the price of each A is 2B very reasonable, and it is cost-effective to replace the A in the hand with 2 B. The trader immediately deposits 1 A, then X in the above formula becomes 1001. In order to ensure that K is still equal to 2000000, Y needs to be changed to 1998, so the extra 2 Bs are just given to the trader.
Of course, there can be only one trader, and many people will find this bargain trade. People want to exchange one A for two Bs. Due to changes in supply and demand, the prices of A and B will also change. As the transaction progresses, the ratio of A and B in the liquidity pool will change. , May eventually become 2000 A and 1000 B, the constant K, that is, the product is still 2000000, the relative exchange ratio of A and B, that is, the relative price is also dynamic. Now we need 2 A to exchange 1 B. Of course, if the demand for A rises as the market changes, investors will also perform reverse operations and start to exchange B for A, and A and B may return to the previous ratio.
In the end, in this case, the traders are equivalent to starting from the price of 1A=2B, and a little bit of A is exchanged for B from the market maker, until the price of 2A=1B is stopped, traders are quite Yu sold a total of 1,000 A in exchange for 1,000 B. At the same time, the market makers fully automated the opposite transaction.
Two points can be seen from this case:
- The price under this mechanism is determined according to the ratio of the two assets in the pool, and it changes dynamically with the transaction in real time.
- The trading behavior of market makers in the market is completely opposite to that of investors, and it is automatic.
We can summarize the process of impermanence loss by observing the above examples. The generation of impermanence loss is closely related to the AMM model. Since the constant K in the formula is constant, the trading behavior of the market maker is determined. Here we simplify the variables to facilitate thinking about the trading behavior of market makers. We assume that the price of one asset in the pool does not change, while the price of the other asset is constantly changing. At this time, if the price of non-stable assets rises, the market maker will fully automatically act in the opposite way to the general market trader, and the more they rise, the more they sell. Therefore, the number of assets in the pool with rising prices will decrease; on the contrary, when the price of unstable assets falls , The market maker will also completely automatically act in the opposite direction to the market, showing that the more they fall, the more they buy, so the number of assets in the pool with falling prices will increase. This is the process of impermanence loss.
A simple example: when 1 ETH = 500 USDT, the market maker deposits 10 ETH and 5000 USDT. The value of his total assets is 10,000 USDT. When 1 ETH = 550 USDT, there is room for arbitrage at this time. The market maker’s liquidity pool will soon continue to buy ETH as traders conduct transactions, and the final price will soon be synchronized with other market prices. In AMM Under the mechanism, market makers will automatically sell ETH in exchange for USDT. Therefore, the current assets in the liquidity pool become 9.53 ETH and 5244 USDT, the corresponding ETH price is 550 USDT, and the total asset value is 10488 USDT. If you don’t do market making, the standard value of USDT is 10500. This price change includes 500USDT caused by the price increase of ETH and the relative 112 USDT impermanent loss. Conversely, when the price drops by 1 ETH = 450 USDT, arbitrageurs will buy ETH until the price of ETH is the same as the market price. Therefore, the market maker’s liquidity pool becomes 10.54 ETH and 4743 USDT, and the total asset value is 9486 USDT. If there is no market making activity, the total asset value is 9500USDT. Relatively speaking, the overall assets depreciated by 500 USDT, and there was an additional loss of 14 USDT in market making. It is not difficult to see from actual examples that regardless of the price rise or fall, under the AMM mechanism, the reverse operation of the liquidity supplier will cause a certain impermanence loss.
AMM market making risk analysis
Through actual observation, AMM market-making mainly faces risks in several dimensions. The most basic is the risk of smart contracts, whether the open source code of the project has been audited, and in some cases, there may still be some loopholes even after auditing. The security of the principal of the liquid staking pool is guaranteed by the code of the smart contract. This article does not discuss this in depth, but investors should regard this as the most basic judgment of the project. The second is the financial risk within the pledge pool. This is mainly divided into two parts. The first is the proportion of assets in the liquid pledge pool, and the second is the price fluctuation risk and impermanent loss included in the financial risk caused by price fluctuations and AMM’s own mechanism. Carryover risk. These two risks are the focus of calculation and discussion in this article.
Review of existing research
Existing research mentions the concept of impermanence loss. Since previous research involved the concept of opportunity cost in economics, impermanence loss has become more difficult to understand. Liquidity market makers often only have plausible concepts. They generally know that there is a risk, and can only pray that the market will not fluctuate greatly, so they will not take this risk.
The existing formula derived from the concept of opportunity cost cannot be directly used by market makers in the market during actual operation. Liquidity market makers cannot directly calculate their own profit and loss ratio using the price fluctuation ratio according to the formula. The current situation is that if investors want to calculate the income, they often have to wait for all assets to be fully liquidated, and then calculate their own income by comparing the final total amount with the initial investment. In the mining process, even if there is a loss, it is actually impossible to know, it is very difficult to implement some risk control strategies. Furthermore, if you want to calculate a risk hedging strategy, it is impossible to start. There are still some studies that only vaguely propose hedging methods, but without accurate calculations, it is impossible to confirm the hedging effect. This article will focus on calculating the profit and loss of asset changes in the pledge pool through mathematical methods, and derive an accurate calculation formula. This method provides a basis for designing hedging schemes for the subsequent hedging of the risk of price fluctuations and the risk of impermanent loss carry-over brought by liquidity pledges. Finally, we will study possible hedging solutions based on the comprehensive profit and loss formula and existing products.
Detailed analysis of the profit and loss of mobile market making
In order to clarify the profit and loss of market makers under the AMM mechanism, we have summarized all the behaviors that affect profit and loss, and classified them according to their nature. Assuming that we regard the benefits of governance tokens obtained by liquidity market making as initial income, the analysis of the profit and loss of LP suppliers under the AMM mechanism is as follows:
Liquidity providers need to consider gains and losses in 4 aspects: 1) Gas fees for on-chain transfers, 2) LP market-making fee income, 3) gains and losses caused by price fluctuations, and 4) impermanent losses caused by the AMM mechanism.
Gas fee for on-chain transfer
The loss of the transfer fee is mainly the gas fee generated by the transfer on the ETH chain, which is a relatively fixed value, and its impact will diminish as the amount of funds increases. In order to facilitate the calculation and drawing of the profit and loss chart, we set the ratio of the Gas fee to the value of the flow cell as a constant in all calculations below. Assume that the sum of all gas fees is 0.05% of the total LP fund pool
Market-making fee income
The current market-making fee in the mainstream AMM model is 0.3%.
The calculation logic of this part is as follows:
LP fee income = average 24-hour liquidity pool transaction amount × handling fee rate × pledge days × LP’s proportion in the pledge pool
Assuming that the average 24-hour liquidity pool transaction quota is consistent with the current liquidity pool value, the formula for the rate of change in return with price changes is as follows:
The derivation of this formula is based on the following four formulas:
NSCOIN_Price × NSCOIN_Num = SCOIN_Price × SCOIN_Num
We use SCOIN for pricing here, so the price of SCOIN is recorded as 1
NSCOIN_Num × SCOIN_Num = k
The value of the entire flow pool
LP Value = NSCOIN_Price × NSCOIN_Num + SCOIN_Price × SCOIN_Num
The price change rate of the pool
LP_Value_Ratio = LP_Value / LP_Value_Initial
- NSCOIN = non-stable currency
- SCOIN = stable coin
- *_Price = the price of a currency
- *_Num = the number of a currency
The income ratio of market-making fees is based on the ratio of changes in the value of the liquidity pool. Combining the above formulas to obtain a formula for the rate of change in return with price changes.
The yield curve is as follows:
This part of the income is related to market prosperity. In addition, if the daily transaction volume can reach 100% of the pledge pool, the annualized rate of return is 0.03%*365=109.5%. This part of the annualized rate of return should not be underestimated.
Profit and loss caused by price fluctuations
Assuming that there is no impermanence loss, the price change of the non-stable currency and its combination value change are linear.
The price changes and profit and loss in the overall pledge pool are as follows:
Impermanent loss carry forward
The specific details of impermanent loss have been carefully introduced in the previous article. From the perspective of opportunity cost, suppose the change in the combined value without liquidity is compared with the change in the value of the LP pool after liquidity is provided, and the formula for impermanence loss is derived as follows:
This formula is based on two conditions:
(1) AMM market-making mechanism in the flow pool
NSCOIN_Num × SCOIN_Num = k
(2) The volume-price relationship between SCOIN and NSCOIN
NSCOIN_Price × NSCOIN_Num = SCOIN_Price × SCOIN_Num
The original formula for deriving impermanence loss based on opportunity cost is as follows:
%Impermanent Loss = (NSCOIN_Price × NSCOIN_Num + SCOIN_Price × SCOIN_Num) ÷ (NSCOIN_Price × NSCOIN_Num_Initail+SCOIN_Price × SCOIN_Num_Initial)-1
%Price Change is the rate of change of NSCOIN price
The corresponding opportunity cost profit and loss chart is as follows:
Among them, %Price Change is the current non-stable currency price change ratio, and %Impermanent Loss is the ratio of the current asset value in the liquidity pool to the price change ratio of the asset portfolio if it does not provide liquidity.
This profit and loss chart clearly shows the conclusion we inferred from the previous example, that is, regardless of the price rise or fall, the reverse operation of the liquidity supplier under the AMM mechanism will cause a certain impermanent loss.
For impermanent losses, if the price fluctuations eventually return to the initial price of the pledge, this part of the loss will not really exist, but this situation generally only occurs when the price of non-stable coins is stable. In actual operations, prices often do not return to the original point of pledge, and impermanent losses will eventually be carried forward to real losses. Because the mining cycle is not long, the market encountered is more likely to be a unilateral market, such as a unilateral rise or fall. This is also the most confusing part of the loss for many investors participating in liquid mining.
The above formula can clearly show the change of opportunity cost. But in terms of actual operation, LP suppliers cannot directly calculate profits and losses through this formula. Therefore, we converted the formula from the perspective of actual operation. Transform impermanence losses into gains and losses relative to the initial value of the LP pool price.
The profit and loss formula combining price fluctuations and impermanent losses after conversion is as follows:
The calculation logic of Real Loss Ratio here is the change in the value of the current LP pool relative to the absolute value of the initial investment
That is (NSCOIN_Price × NSCOIN_Num + SCOIN_Price × SCOIN_Num)÷
(NSCOIN_Price_Initial × NSCOIN_Num_Initail+SCOIN_Price_Initial × SCOIN_Num_Initial)-1
Comprehensive profit and loss formula
According to the above analysis, we can get the comprehensive profit and loss formula:
Profit and loss formula = price fluctuation profit and loss + impermanent loss actual loss carried forward by opportunity cost + LP market-making income + Gas fee
The final formula is as follows:
The formula of Fee Income Ratio:
According to the above formula, we can draw a comparison chart of profit and loss with price changes when LP suppliers and non-LP suppliers hold the same assets:
The blue line in the figure is the profit and loss of the non-LP supplier’s value with price fluctuations under the same asset. The orange line in the figure corresponds to the profit and loss of the LP provider of the same asset.
In the rising market, the short-term return of LP assets will be basically the same as the return of non-LP. Only after exceeding the increase of the intersection point will there be differentiation. The intersection point is at a position where the price has risen roughly 50%, which is slightly affected by gas fees and handling fees.
Roughly in a falling market, the loss rate of LP pledged assets is not constant like non-LP assets, but is constantly accelerating, which is caused by impermanent losses.
After the above analysis, it is not difficult to see that as the currency price fluctuates, market makers under the AMM mechanism mainly need to hedge two parts of the loss. One is the loss caused by the falling currency price, and the other is the impermanent loss caused by the increase or decrease in the price of non-stable currencies and the increase in their price changes. Regarding impermanent losses, we can judge that the trading strategy of liquid market makers under the AMM market-making mechanism is concave compared with non-market-making and only holding currency. Nassim Taleb’s suggestion for venture capital is a risk It is necessary to maintain convexity, that is, there is a hedging plan regardless of whether the price is up or down. Based on this principle, we have selected the products currently available in the market. Currently, the main available products include contract products with rich currencies and option products with mainstream currencies.
Hedging product selection
Why can’t you choose a contract
At present, the most useful hedging tool in the market is the contract product. After the analysis in the previous article, we see that the profit and loss of LP suppliers is not linear. The contract product as a linear tool cannot cover the nonlinear risk well. The picture below is The effect of using contract hedging. When the price of a non-stable currency falls, the value of the entire liquidity pool accelerates, and when the price of a non-stable currency rises, the value of the entire liquidity pool rises slowly. Then if we short the contract to protect it, it cannot be completely when the currency price falls. Covering the loss, when the currency price rises, the contract value linearly decreases, and the rate of loss is faster than the growth rate of the value of the liquidity pool, which results in the hedging effect shown in the figure below. It is not appropriate to hedge with contract products.
It is an ideal choice for current loss option products. The main reasons are as follows:
* Controllable cost
The current liquidity market making time will not be very long, so there is no need to buy very forward options. The time value in the option is not high, so the option price will be relatively cheap. From the point of view of the profit and loss chart, it is sufficient to use the deep virtual option, because the price of the virtual option near the flat value is more expensive and will incur a larger cost. From the absolute price, the price of the deep virtual option is relatively cheap.
* Options, as a protection tool, have sufficient price risk coverage area and will not offset the gains brought by currency price increases
For example, using a put option to hedge against the risk of a fall in the price of a non-stable currency, when the price is lower than the set execution price, the profit and loss chart of the put option is linear like the contract. If the purchase amount and the pledge amount in the liquidity pool are adopted 1: 1 Hedging, which can hedge 50% of losses in extreme cases. When the price of a non-stable currency rises, the profit and loss of the put option is 0, which will not affect the price of the LP liquidity pool.
Partial hedge against impermanence
According to the above analysis, we choose to buy deep virtual put options and call options for hedging.
The yield chart for price changes is as above. The measurement shown in the figure is a put option with an exercise price at 80% of the initial price of a non-stable currency and a call option at 140%.
We first separately measured the free loss part of the option product hedging. Using put options and the value of non-stable currencies in the liquidity pool at 1:1, the hedging results are as follows:
It can be seen that the impermanence loss is completely covered when the price changes greatly. At the same time, it can be seen from the above figure that when the price changes little, the loss after hedging is slightly greater than the impermanence loss. This is because this price range is not within the option exercise range, but we paid the premium and incurred a certain cost.
Overall liquidity pool hedging
According to the calculation of the previous profit and loss model, the rising income will diverge only when the price rises to about 50%. Therefore, the call option price can be about 1.5 times the average value when hedging the impermanent loss of the rise.
In the falling market, it is necessary to hedge the two parts of the free loss and the actual price drop. We first measured the 1:1 hedging method of put options and call options with the value of non-stable currency assets in the liquidity pool. The result is as follows:
It is not difficult to see that when the price of non-stable currency rises to the hedging range, buying call options at a ratio of 1:1 can not only hedge the impermanent losses, but also bring additional gains. In extreme cases, 1:1 buy put options can only hedge 50% of the loss. Therefore, we adjusted the ratio of put options and used 2 put options: 1 call option for hedging. The result is as follows:
In this way, as long as the time period can fully cover the liquidity market-making pledge cycle, the assets in the non-stable coin-stable coin liquidity pledge pool can be basically non-destructive mining, and there is a slight positive return.
In addition, in terms of option selection, the trade-off between option premiums and unhedged losses needs to be considered.
The calculation formula involved in hedging is as follows:
Put Value = (Max(Strike Price-ETH Price, 0)-Put Price)×2 Call Value = Max(NScoin Price-Strike Price, 0)-Call Price Hedge Value = Put Value + Call Value PnL hedged = LP pool value + Hedge Value + Fee income – Gas Fee
- K = Constant number
- P = NSCoin price
- fee_rate = the proportion of market-making fee income, refer to Uniswap as 0.003
- Gas fee = wallet transfer fee, set as 0.05% of the initial investment in the Portfolio
- T = lock-up days
- Volume = LP’s daily transaction volume, initially set by LP value 1:1
- P_init = initial price of non-stable coins
Actual hedging case
Let’s take HuobiGlobal’s ETH option product as an example. It is currently September 26th. Participate in liquidity market making in the ETH-USDT pool. The price of ETH is 350 USDT. Generally, the mining cycle is short. Choose a put option with an expiration price of 270 USDT to protect the price from falling Risk, there are still 7 days before delivery, and the marked price of 1ETH is 2.64 USDT. When the mining expires, the overall profit and loss caused by the price change of ETH is shown in the figure below. When the strike price falls below 270, the put option begins to play a protective effect.
We bring the actual data into the above formula to calculate the hedging effect of the put option with the total amount of purchased and non-stable currency assets at 1:1 as shown below.
It can be seen from the figure that the total amount of bought and non-stable currency 1:1 put options can play a certain hedging effect. However, the assets in the liquidity pool still face greater risks when prices fall.
According to the above formula, the hedging situation of the put option with the actual variable purchase and the total amount of non-stable currency 2:1 is as follows:
In terms of call options, we believe that in actual operation, the price will rise more than 50% before differentiation. For currencies with relatively stable prices, there is a lot of room for maneuverability in this situation. Therefore, we can consider not buying call options for hedging. Can actively operate according to the market to save costs.
Through actual cases, we can see that buying two put options can basically cover the main risks of liquidity market making. If the price of non-stable coins fluctuates greatly,
The problem of option hedging
Through examples, it is not difficult to see that on-market options may also have certain problems, mainly reflected in the inaccuracy of time coverage and insufficient market depth.
Time period coverage
Market options are standardized products. The exercise price and expiration date are set by the platform. The probability of matching with the mining cycle is not high. If they cannot be matched, the market maker can only choose a slightly longer mining cycle. Option products, the option can be closed at expiration. There will be additional cost consumption, and some additional active trading operations may be required.
The impact of market depth
In addition, due to the depth of the market, if the amount of mining funds is relatively large, it may not be possible to buy the amount that fully covers the risk. Regarding this point, due to the supply-demand relationship between buyers and sellers in the options market, this problem may be gradually alleviated as market demand increases.
The best possible hedging plan so far
OTC options customized according to customer needs may be the best hedging option at present.
OTC options have the following advantages, which are more in line with the needs of liquid market makers. First of all, the hedging standard can be customized, which is more in line with the needs of liquid market makers, which gives liquid market makers more choices in the liquidity pool. The second is flexible exercise. Because of this feature, liquid market makers can agree on an exercise cycle with OTC option providers, so OTC options can accurately cover the complete market-making time period of liquid market makers. Finally, the leverage is flexible. Over-the-counter options can choose the characteristics of different exercise prices and maturities, making the leverage of options adjustable, which improves the utilization rate of funds of liquidity providers.
Finally, OTC options are extremely professional, and the supplier’s credit endorsement is also very important. Therefore, in the process of choosing an OTC option supplier, we should actually pay attention to the supplier’s redemption risk.
Risk analysis of hedging solutions
At present, the existing 2:1 option hedging scheme can basically cover the previously identified price fluctuation risk and impermanent loss carry-forward risk. But it also introduces some new risk points. Since our use period covers long-tail risks, when extreme market conditions occur, option redemption risks are worthy of attention. In the extreme market conditions in March this year, a well-known platform guaranteed the redemption of options through advance payment. For this, choosing an option market with 100% margin from the seller may be a better choice. In addition, if over-the-counter options are adopted, the supplier’s ability to pay is more worthy of attention.
to sum up
Through accurate calculations, this paper derives the comprehensive profit and loss calculation formula for the profit and loss of the non-stable currency-stable currency liquidity supplier under the AMM mechanism with price fluctuations. This formula allows liquid market makers in the market to achieve precise risk control and lays the foundation for the subsequent accurate calculation of hedging products. After that, this article discusses possible hedging schemes based on the existing financial derivatives in the market. Because it can be calculated, we can get accurate hedging results. In terms of hedging impermanent losses for contract products, because contract products are linear instruments, they cannot cover nonlinear risks well. At present, option products are more in line with our hedging needs. In terms of cost, using standardized option purchases and deep virtual put options with twice the total amount of non-stable currency assets for hedging can cover most of the losses. But there may be some problems in terms of time period and market depth. Therefore, the use of customized over-the-counter options by large liquidity market makers may be the best risk hedging option at present.