How to Hedge Yield Farming Risk with Perpetual Contracts

Find out how you can use perpetual contracts to hedge your yield farming risks

This is a more advanced article. Make sure you understand what yield farming is and the risks associated with it before reading this. If you don’t, this article is a good starter.

While the annual percentage rate (or “APR”) for yield farming can be as high as 3-digits sometimes, the impermanent loss can eat into your profits or wipe them out entirely. If you don’t know what impermanent loss is, please check this article.

Here is an example:

Assuming the APR for a new yield farm is 150% and the token for this project (“Token A”) is traded at 300 USDC each. You put 500 Token A and 150,000 USDC into a liquidity pool on Uniswap for this project. After selling the tokens received for providing liquidity for 45 days the cumulative yield stands at 55,479.5 USDC (150,000*2*150%/365*45), and you decide to stop providing liquidity. 

However, you’re surprised to find out that the price of Token A has dropped to 150 USDC each. So when you withdraw your tokens from Uniswap, you get 700 Token A and 105,000 USDC in return. (You receive more Token A than the amount you put in because of the drop in price.) If you sell the 700 Token A at 150 USDC each and combine the proceeds with the 105,000 USDC, you’ll find out you lost 90,000 USDC in total ((700*150+105,000)-150,000*2) due to impermanent Loss. 

So as you can see, despite a three-digit APR, you can still lose money participating in yield farming. In our example, the net loss was 34,520.5 USDC (55,479.5-90,000)

Yikes! But what can you do to hedge this risk?

It’s quite simple. What you need to do is to open a short position at a perpetual contract exchange right after you start providing liquidity. If you’re not familiar with perpetual contracts, please check this article.

Let’s take a look at how adding a short position can help in our previous example:

  1. Like in our previous example—Token A is traded at 300 USDC initially and the APR is 150%. You deposit 500 Token A and 150,000 USDC into a liquidity pool.
  2. Once the deposit is done, you open 500 short positions for Token A using the perpetual contract. As a reminder, you need to provide other assets as collateral to open your position—USDC in many cases.
  3. Keep selling the tokens received for providing liquidity on the market for 45 days and receive 55,479.5 USDC (150,000*2*150%/365*45) overall.
  4. Withdraw your liquidity from the liquidity pool and get 700 Token A and 105,000 USDC in return. Sell the 700 Token A and realize the 90,000 USDC loss.
  5. But since Token A’s price dropped from $300 to $150, the short position you opened in the second step became a profitable trade for you. You should profit 75,000 USDC (500*150) after closing the short position.

To sum up, thanks to the profit from the short position, you turn the previous 34,520.5 USDC net loss into a profit of 40,479 USDC. 

Additionally, if you execute this tactic in a bull market, chances are you can earn funding payments as well. If the average hourly funding rate during the 45 days was 0.003%, you can receive an extra 3,645 USDC ((300+150)/2*500*0.003%*24*45) from your short position. Again, if you’re not familiar with funding payments, please check this article.

You can learn more about what will happen if Token A’s price surges instead of falling with these slides.

Or check the mini-workshop video on our YouTube channel for the same topic.