Leveraged Yield Farming — Can it be Delta-Neutral?

Marco_112358
10 min readFeb 7, 2022

Providing liquidity and Yield Farming (YF) are important concepts in the world of DeFi. Check out this article describing the process, benefits and risks of yield farming.

In my opinion, there are 2 large risks of yield farming. The first is the fact that you are very exposed to the price appreciation and depreciation of the assets you are providing to the Liquidity Pool (LP) when you yield farm. This risk is something people are familiar with if they already hold both tokens. This is similar to normal hodling risk (similar but not the same!). The second risk is Impermanent Loss (IL). IL is a feature of providing liquidity to a constant product Automated Market Maker. Basically, IL is the opportunity cost of providing liquidity to an AMM instead of holding both tokens. This happens because as the price of Token A (relative to token B) goes up, the amount of token A you get back (if you redeem your LP tokens) goes down relative to the initial amount of token A you supplied. In that case, it would have been better to just hodl token A instead of supplying it to the LP. The complete opposite happens when the price of token A (relative to token B) goes down, meaning you would have less token B than you initially supplied and still have an impermanent loss, relative to hodling.

Some people want to be able to yield farm, using leverage, and not be exposed to the price changes of one of the underlying tokens. You will see this called delta-neutral (or pseudo delta-neutral PDN) Leveraged Yield Farming (LYF). This is theoretically possible, and there is a specific condition where you are truly delta neutral (when the price at time ‘t’ is equal to the starting price), but as soon as the price changes, you are no longer delta-neutral (i.e. you have some exposure to the underlying token prices). I have a stylized example below with graphs, and an appendix where I attempted to work out the proof of delta-neutral LYF, along with some functions. Here are another two great articles on the process by DarkRay (article 1, article 2) (give him a follow, he puts out some really great stuff on Solana DeFi).

Note that in the rest of the discussion below, I assume that you can always borrow both assets for LYF. This completely depends on different protocols, borrowing has its own risks. You could be liquidated if you do not watch your positions debt to equity ratios (or debt to assets ratios). And there are times when you cannot borrow anymore when you would need to for rebalancing purposes. Lending rates are also constantly changing, and can overwhelm any yield you get from YF. These are extremely important point to consider before ever taking on any leverage.

First, let’s define delta and gamma, the first and second derivatives of your equity (or total value) functions.

  • Delta — this is the first derivative of the total equity (or total value of your position) equation. It is how much will your equity change with a 1 unit change in the price (i.e. how much will my equity change if SOL/USDC goes up by 1 USDC).
  • Gamma — this is the second derivative of the total equity (or total value of your position) equation. It is how much will your delta change with a 1 unit change in the price (i.e. how much will my delta change if SOL/USDC goes up by 1 USDC). It is the rate of change of delta.

Hodling always has a constant delta. Many people will say hodling has a delta of 1 (delta-1 position). This just means that when the price goes up by 1, the equity of holding 1 token goes up as well. When you YF, your delta starts at the same place as Hodling, but immediately changes as the price changes. If the price increases, your delta decreases, and if the price decreases, your delta increases. This is due to the fact that your gamma is always negative. (For anyone with some options experience, it seems like YF has similarities to selling options). What all this means is that Impermanent Loss is real. When the token price is decreasing, you are losing more equity than if you just Hodl, and when the token price is increasing, you are not gaining as much equity versus just hodling. Another way of looking at it is if you are already YF and the token price is below where you started, you benefit more from the token price going up versus hodling (this is because you are capturing back that IL on top of the regular gain from the price increasing).

Pseudo delta-neutral (PDN) LYF is trying to neutralize that exposure to the underlying price. Now, this is not truly possible without constantly rebalancing your portfolio. But, we can at least see what it looks like. There is a stylized example below, but effectively you can borrow both token (in different percentages) and provide some equity and be partially neutralized to small changes in the price. This strategy works the best when the price does not change by that much. It outperforms both regular YF and hodling when the price doesn’t change too much or goes down (because you are somewhat neutralized to price changes). But this strategy underperforms when the price increases drastically during your holding period. PDN LYF has a delta of 0 when the price does not move, but then delta experiences a similar pattern to regular YF. Delta becomes positive when the price decreases (below the starting price), and delta becomes negative when the price increases (above the starting price). This is completely due to the fact that pseudo delta-neutral LYF also has negative gamma, and this negative gamma is greater than the negative gamma of regular YF.

Let’s check out a stylized example below with some numbers, so that we can see what our different potential trade look like, along with profits/losses, deltas, gammas. There is a more ‘formal’ proof in the appendix.

Stylized Example of a Delta-Neutral Leveraged Yield Farming Strategy

Example: You want to deposit $200 USDC into a pseudo delta-neutral Leveraged Yield Farming (LYF) strategy on SOL-USCDC. We assume that SOL is current worth 100 USDC, and USDC is equal to $1 USD (and is truly stable). You are going to lever this strategy 3x by borrowing 3 SOL and 100 USDC. Your borrowed position is worth 400 and the total position is worth 600 (with 200 of equity) at the start of the trade. The yield farming APR is 40% (compounded continuously), the lending rates on both SOL and USDC are 20% (compounded continuously). You hold this position for 30 days and do not rebalance (re-hedge) at all during the 30 day period. All changes in price occur linearly over the 30 days.

First let’s take a look at the different positions you could put on with 200 USDC. This first graph shows both your ending equity value, and your P&L in percentage terms.

Next we will take a look at the deltas of these different positions, with different ending prices of SOL/USDC after 30 days.

Finally we will take a look at the gammas of these different positions, with different ending prices of SOL/USDC after 30 days.

To summarize delta and gamma, what they really do is give you an idea of your risks when you have not rebalance. They prove you are only 'delta neutral' when price has not changed from the initial price. In PDN, when price drops, your delta goes positive, so you become long the risky token (SOL). And gamma is more and more negative, so you get more and more long the risky token the more price moves down. When price moves up (relative to the initial position), your delta goes negative and so your short the risky token. Gamma is negative (but less and less negative) so you are still getting more short the risky token, but the increase (change) in your short portion is less and less (gamma is lower and lower negative amounts).

Hopefully these graphs and the stylized example help explain the different risks you face when you hodl versus YF vs pseudo delta-neutral LYF. and more importantly, how your equity exposure changes as price changes (how you become long or short the risky token). Each of the strategies in the graphs above have different exposures to the underlying price, and have different risks. Yield farming has its own risks (IL plus protocol/smart contract risks, etc.) and adding leverage has even more risks on top of that (more smart contract risk plus liquidity risks plus liquidation risks). These are all very important to consider before trying this yourself. And I would highly recommend using models before actually putting real money at risk. Tulip Protocol has a great scenario analysis tool on its Leverage Yield Farming page. Please be careful when using leverage. Digital assets, crypto, is very very volatile, you could easily be liquidated while you sleep!

Good luck and happy degening!

Below is my proofs for proving that you can achieve a delta-neutral position using leverage when the price at time ‘t’ is equal to the initial price, for a 50/50 constant product AMM. This essentially means to stay delta neutral, you would need to continuously either supply equity, or add debt (depending on how the price changes). The examples use 3x leverage (so if you supply 100 initially, you borrow 200 for a total position of 300, which 300 / 100 = 3x).

Appendix: My ‘proofs’ for Total Value/Assets/Debt/Equity Functions along with the first two derivatives

  • A is the risky token (i.e. SOL, ETH, etc.). This is the token we want to attempt to neutralize when using leverage.
  • B is the stablecoin in our example (i.e. USDC). We will still be net long this token after leverage is applied.
  • P = Price
  • S = Supply (to AMM) (in underlying coins)
  • TV = Total Value of an LP position (used when no leverage applied)
  • B = Amount of Coins Borrowed
  • r = Rate (lending rate of coin A or B or yield farming APY of whole LP)
  • L = Leverage (3x)
  • Debt is amount borrowed in USD
  • Assets is amount in LP when using leverage (LYF) (initially supplied equity plus amount borrowed)
  • Equity (EQ) is either initially supplied or Assets — Debt
  • t is some future time

First, let’s set some of the initial parameters:: Prices, Total Value, and some others.

Let’s now solve for the Total Value Function of an LP position, without leverage, along with the first and second derivatives, with respect to price at time ‘t’.

Time for some Leverage

Let’s now see how to set the leverage, debt, and what percent of debt we should take in coins A and B. Note we are assuming a 50/50 Constant Product AMM here.

Let’s now solve for the Total Assets, Debt, and Equity Functions of an LP position, with leverage, along with the first and second derivatives, with respect to price at time ‘t’. We will plug in Leverage = 3, and x = 75%. We also assume here that you do whatever swapping in necessary so that you match the needed 50/50 split of the AMM for your total Assets. You still want your initial coins of A (borrowed and initially supplied) to equal the total amount borrowed. If you only supplied the stablecoin to this strategy, your total initial coins A will be 100% borrowed (equal to 75% of the total amount borrowed).

So we see that the first derivative of our equity position (delta), is slightly different than the delta of the ‘no leverage’ LP (there is a minus Borrowed tokens A). So lets figure out if this new delta can be =0, and more importantly, at what price is this new delta = 0.

Please let me know if you see any issues with the logic above, either in the proofs or in the stylized example. Thank you!

About the Author

For full disclosure I mostly use Solana for DeFi, because I don’t have enough assets to justify Ethereum gas fees. I have a little bit in Algorand, Cardano and Polkadot DeFi. I am actively involved in multiple Friktion volts and a contributor in their Discord, and am beta testing Dappio Wonderland 🐰.

I am invested in SOL, ADA, ETH, DOT, ALGO, MIOTA along with plenty of other tokens.

This is not Financial Advice!

--

--

Marco_112358

TradFi background (CFA/CFP), DeFi Degen. Love ETH, ADA, ATOM, KUJI, SOL, DOT, NEAR,