DeFi is changing finance in many ways, while also bringing in additional risks. Impermanent loss in automatic market maker (AMM) liquidity pools is one of the best known new types of risks that has sprung out of the DeFi boom. Can impermanent loss be hedged in a decentralized way? And if so, how?
FinNexus is a decentralized cross-chain options platform with a peer-to-pool model. It pools all the liquidity together in a collateral pool and collectively acts as the seller for writing and settling options. FinNexus Protocol for Options (FPO) v1.0, now live on both Ethereum and Wanchain, provides keys to hedging against impermanent loss potentially suffered by AMM pool participants. This article will explain how the combinations of options may work together to tackle this problem.
To understand impermanent loss (IL), we need to grasp several basic concepts and models.
AMM stands for an automated market maker. This is a class of decentralized exchanges that rely on mathematical formulas to price assets. Different from using order books like in traditional finance, assets are priced according to a pricing algorithm coded in the smart contracts. Liquidity pools are created for each trading pair of tokens, while projects like Balancer even allow for the creation of pools with more tokens.
The pool provides liquidity for asset trading, in an automated manner. In other words, traders don’t need to find someone else to sell their coins to or buy their coins from. Transaction fees are distributed automatically among all the liquidity providers, according to the shares they are holding in the liquidity pool.
There are a number of AMM projects on the market, like Uniswap, SushiSwap, Curve, Balancer, Bancor, DODO, etc.. As compared to centralized exchanges (CEX), we tend to call these projects decentralized exchanges (DEX) with AMM mechanisms.
Though the liquidity is pooled and shared, the mechanisms behind AMMs may vary.
The XYK model is the most well-known and widely applied AMM mechanism in DEXs. I wrote a comprehensive introduction to this model before. Uniswap and SushiSwap, both of which had over 1 billion USD locked as of Nov. 2, 2020 and ranked top second in all DEXes, are representative projects of the model.
The XYK Model is also called the “x∗y=k market maker.” The idea is that you have a contract that holds x coins of token X and y coins of token Y, and always maintains the invariant that x∗y=k for some constant k. The value of the token X and token Y always stay the same, or the pool has 50/50 shares for both tokens. The changes in the numbers of tokens will change the price.
Suppose there are no transaction fees, anyone can buy or sell coins by essentially shifting the market maker’s position on the x∗y=k curve as below; if they shift the point to the right, then the amount by which they move it right is the amount of token X they have to put in, and the amount by which they shift the point down corresponds to how much of token Y they get out.
According to XYK, in the chart above, x1∗y1= x2∗y2=(x1+Δx)∗(y1-Δy)=k
For example, consider the case where a liquidity provider adds 40,000 DAI and 100 ETH to a pool (for a total value of $80,000), the price of ETH is 400 DAI at this time. The constant k=40,000∗100=4,000,000
Suppose there are no transaction fees. Someone wants to sell ETH for DAI, so he/she sells 5 ETH into the pool. Then, the pool has 105 ETH. With the XYK mechanism, k stays constant as 4,000,000. Therefore, the number of DAI in the pool becomes 4,000,000/105=38,095.24. The ETH seller gets 1904.76 DAI in return. The pool price of ETH becomes 38,095.24/105=362.81 DAI. The real ETH exchange price to the seller is 1904.76/5=380.95 DAI.
Impermanent loss is the loss suffered by the liquidity providers in AMM liquidity pools. It happens when you provide liquidity to a liquidity pool, and the price of your deposited assets changes compared to when you deposited them. The bigger this change is, the more you are exposed to impermanent loss. But if the price shifts back to the point when you make the deposit, the loss will disappear. Therefore, we call this loss “impermanent.”
Impermanent loss is not the total loss of the net worth measured in USD, as we usually evaluate the financial behavior of a portfolio. It is the loss in the pool compared with the case when just holding the assets.
Impermanent loss is usually observed in standard liquidity pools where the liquidity provider has to provide both assets in a correct ratio, and one of the assets is volatile in relation to the other; for example, in a Uniswap DAI/ETH 50/50 liquidity pool, as in the Uniswap docs.
Following the example above, suppose there are no transaction fees, 1 DAI is worth $1, and the ETH market price changes to the same price as in the pool.
The impermanent loss is calculated as the difference between the value of tokens when not in the pool and the one in the pool as a liquidity provider at T2.
The impermanent loss seems to be not much in this case, but it may grow a lot larger if the price moves more dramatically in either direction.
The blue line below is the change in value for just holding 100 ETH and 40,000 DAI. The yellow line is the value when one puts them into the 50/50 AMM liquidity pool. The difference between the two lines is the impermanent loss.
As we may notice, the IL grows when the ETH price moves in either direction, away from the one when he/she makes inputs — and it grows more significant as the price moves further away. If the transaction fees and mining incentives allocated are not enough to compensate for the IL, the liquidity providers will end up with a loss.
With the same logic above, we could derive the formula for the size of the impermanent loss in terms of the price ratio between when liquidity was supplied and now. If you are interested, you could read this article for the derivation process.
Where LR is the impermanent loss ratio, p1 and p2 are the price at the Time of T1, T2 respectively.
Impermanent loss happens no matter which direction the price changes — instances when the price drops can be more dangerous than when the price increases.
Perpetuals and futures are common instruments hedging against price movement risks, especially for the spot crypto market. However, from the analysis above, the losses suffered by the liquidity provider in AMM pools is not linear, but bidirectional. IL is undertaken in either direction of price movement. While perpetuals and futures are linear hedging tools, they cannot effectively protect the liquidity providers in both directions.
Options are ideal instruments for hedging IL risks.
Options’ profit and loss are not linearly distributed. For option buyers, different from perpetuals or futures, they have only rights, but not obligations. This means that they can choose to stay put when the market moves in an unfavorable direction.The loss is capped to the option premium, but the potential gains are not limited. The P&L of calls and puts holders are shown in the following chart.
Although, when the option holders are in profit, as the green part in the chart, the profit goes linear, we can still combine options with different strike prices and quantities, to make the convexity of the IL offset.
As an option buyer/holder, one just needs to pay the option premium without needing to lock any additional collateral/margin in the contracts. Option holders have no risks of being liquidated. The premium is all the cost, that one has to pay for the rights of buying or selling the underlying assets in the future.
Also, IL becomes more significant when the price moves away, to a greater extent, from the point when one contributes assets into the pool. Therefore, a trader may need to buy OTM puts and calls to hedge against the loss. The strike price is one of the key factors in pricing options. For OTM options, the prices will be much lower than ATM or ITM options and can lower the cost for liquidity providers.
The shape of the IL curve appears to have some convexity, so the basic idea is to make the curve as horizontal as possible, ideally like the red line below.
To make a good hedge, the P&L of the instrument needs to perfectly offset that of the IL, as with the blue curve below. Yes, it can be difficult. Let’s have a trial with a call and a put and check how it works.
With a strategy of longing a strangle, which holds both a call and a put on the same underlying asset with different strike prices, as it is shaped below, we may offset the IL to some extent.
Let’s try with one set of calls and puts, with ±30% of the spot as the strike price, and we hold the same amount of options as the unstable assets in the liquidity pool.
Following the same example above, the liquidity provider buys 100 units of call options with the strike price $520/ETH and 100 units of put options with the strike price $280/ETH, with an expiry of 30 days.
Please refer to details of calculation here.
From the chart above, it is observed that:
1. The IL has been totally balanced out when the price increases above 40%. In addition, the call option ends up in profit and it is more than enough to hedge against the IL, as shown in the right wing of the orange curve.
2. In the left wing, the hedging strategy with the puts goes well and ends up with profit. However, due to the case that the loss accelerates as the price collapses further, this put option will not be enough to compensate for the loss, and the return finally ends up in the negative.
3. For holding calls and puts together, with the same amount as the ETH in the liquidity pool, the fixed cost of this hedging strategy is high. According to the calculation, the fixed cost of the option premiums is 2.25% of the initial investment, and it is a protective strategy for 30 days.
The cost can reach 27% yearly if the strategy repeats every month. The cost is high.
Some adjustment can be made for a better hedging result.
1. The IL ratios when the ETH price going up and down are not in a symmetric manner;
2. Multiple combinations of calls and puts should be used for upward and downward hedging;
3. The quantities of options can be adjusted to make the yellow line less upwarping to fit different strategies;
4. The effective range of hedging doesn’t necessary to cover all of the price movement from -100% to +500%.
Due to the linear characteristics in the profit behavior against the price changes, when the options are in-the-money, it is impossible to perfectly hedge against the IL (which has a convex nature) with just one kind of calls and puts. However, with combinations of multiple puts and calls, we may find a way to offset the IL more effectively while adjusting the weights of different options with various strike prices.
Let’s take a look at the following strategy. We follow the same example above.
1. Hedging range of prices: from -60% to +100%;
2. Hedging period: 30 days;
3. Call options: 6 ETH calls with strike price $480 (+20%), 8 ETH calls with strike price $520 (+30%), 10 ETH calls with strike price $560 (+40%);
4. Put options: 8 ETH puts with strike price $360 (-10%), 10 ETH puts with strike price $320 (-20%), 15 ETH puts with strike price $280 (-30%), 5 ETH puts with strike price $240 (-40%).
Please refer to details of calculation here.
The orange curve after hedging is much flatter in the hedging range, and the cost of option premiums are more acceptable than the last strategy.
With different combinations of calls and puts, the results could be varied much and tailored to different strategies.
These strategies work only in the highly liquid market of options. Even in Deribit, which contributes to over 90% of the total volume, the order books of BTC and ETH options are still not deep enough, especially for OTM options, which are particularly needed for this IL hedging strategy.
Is this a deadend? No.
Decentralized options with the peer-to-pool model show us the way out. With pooled liquidity, the collateral pool acts as the sole counterparty for all options and the buyers can customize options with much flexibility, while with little price slippage. Liquidity is shared, and when buying options, the buyer is trading against the pool, rather than matching with a specific option writer.
The liquidity for OTM options is the same as any other kinds.
Typical decentralized option platforms as Hegic and FinNexus provide us with these choices.
FinNexus has pioneered this IL hedging strategy. One of the many advantages in the FinNexus Protocol for Options (FPO) model is the creation of a stable coin USDC pool and to trade and settle options with stable coins.
This hedging strategy can be a great combination with vaults mining in AMM platforms; and it is also useful as a protective plan for institutions and individuals with AMM liquidity pool contributions. FinNexus is expecting to build an easy UI for IL hedging in the future.
This article is inspired by this research from Huobi and was originally published on CoinMarketCap on December 16, 2020.