Liquidity Provider Strategies for Uniswap v3: Dynamic Hedging

Atis E
11 min readMay 31, 2023

This installment in the series focuses on dynamic re-hedging as a way how to beat divergence loss (impermanent loss).

Recap of the previous article

The typical goal of LPs is to beat the “HODL” benchmark, which is simply holding the initial assets instead of putting them in a liquidity pool. The previous article in this series demonstrates how LPs are likely to lose money compared to the HODL benchmark when the prices of the underlying volatile assets change significantly.

To partially safeguard the LP’s capital, hedging strategies can be used. Shorting or borrowing the underlying asset protects the capital if the price decreases, while longing the underlying asset safeguards the capital if the price increases.

Linear and non-linear payoffs

Convex payoff is better than linear whether price goes up or down; concave payoff the opposite (source: https://twitter.com/guil_lambert/status/1496506629063331843)

The payoff of a HODL position follows a linear pattern. In a literal sense, the value function resembles a straight line. This remains true for all HODL portfolios:

  • the payoff of holding only the stable coins is a horizontal line
  • the payoff of 50:50% HODL portfolio is the y=x/2 + const line
  • the payoff of 100% volatile asset is the y=1·x line
  • longing the volatile asset through 10x leverage trading has y=10·x payoff and shorting it with 10x leverage has y= — 10·x payoff (up to the point of liquidation, and assuming a zero funding rate for simplicity).

In contrast, the payoff of an LP position is nonlinear:

  • the value of a full range LP position, Uniswap v2 style, grows with the square root of the price.
  • Uniswap v3 position values and payoffs are more tricky to describe mathematically, but the basic intuition is that concentrated liquidity makes all things more extreme, including the non-linearity of the LP value and payoff functions.

When a linear function is added to a nonlinear one, the result is always another nonlinear function, similar to how multiplying a negative number by a positive one always yields a negative number. It means that LP positions cannot be perfectly hedged by just longing or shorting the volatile asset once.

Before going further, a couple of potential questions I should clarify:

  1. “Is it the nonlinearity itself that is bad?”, and
  2. “Can’t we have AMMs with linear payoffs as they would be better for LPs?”
  3. It’s the special kind of non-linearity called concavity or negative convexity, also characterized with negative gamma, that is bad for LPs.

2. This kind of non-linearity is present in all reasonable AMMs (as mathematically demonstrated in this paper), not just the Uniswap’s xy=k type of AMM. Therefore it’s usually fine to use the mental shortcuts “linear = beneficial for LPs” and “nonlinear = detrimental for LPs” in this context.

There are AMMs with bonding curves that are close to a line for some values of the price. Curve is the most well known of these. However, while Curve offers nice properties for stable swaps, it has higher slippage and risks for LPs at the extremes of the bonding curve, when the price deviate s too much from the stable region. Essentially, Curve reduces the likelihood of losses, but increases the severity of the losses if they do occur.

The Greeks

Let’s have a quick recap on the Greeks in a financial context.

  • The first derivative of the portfolio’s value function with respect to price is called delta. It represents the rate of change of the portfolio’s value in relation to price.
  • The second derivative is known as gamma. Gamma denotes the rate of change of delta with respect to price.

Example values of the Greeks:

  • All HODL portfolios have zero gamma. Delta for HODL portfolios that don’t have loans or leverage ranges from the delta-neutral 0 to +1.
  • All LP positions have negative gamma. In the special case of full-range LP positions the gamma is inversely proportional to — √alpha³, where alpha is the change in price relative to the initial price at which the position was created.
Negative gamma payoff: profits decrease when the price rises, and losses amplify when the price declines. https://siamohajer.com/convexity-vs-concavity/

Negative gamma is related to the crypto-native concept of impermanent loss, alternatively and more accurately called “divergence loss”.

Positive gamma payoff. https://siamohajer.com/convexity-vs-concavity/

Positive gamma is the opposite: it signifies value functions that are convex rather than concave. Certain protocols use the term “impermanent gain,” which I’ll admit does sound attractive.

Fighting the negative gamma

What should an LP do when faced with negative gamma? Here are some ideas:

  1. Maximize fee income. LPs are profitable relative to HODL when fee income is greater than the divergence loss.
  2. Look for less volatile pairs. The expected value of the impermanent loss is function of volatility squared (source 1, source 2).
  3. Hedge the position by buying financial instruments that have positive gamma, such as options and power perpetuals.
  4. Dynamically re-hedge the position when ever price changes (the topic of this article).

Before discussing the last idea in depth, here’s a quick overview of the first three.

1. Maximizing fees

At the core it’s often about selecting a good pool, selecting a good fee tier, guessing what the market is going to do next: more similar to trading than to passive investing. The pool’s APY is not a sufficient metric, some better ideas are to use an implied volatility metric or compute the pool’s Sharpe ratio.

Luckily there are new upcoming protocols that will allow to generate additional fees, such as lending out LP positions (GammaSwap) or locking them in other ways to earn additional fees (Infinity Pools, Panoptic). However, even these extra fees might not be sufficient to guarantee profits.

High fee APR positions — the result or lucky guesses? Image from revert.finance

2. Less volatile pairs

Stable pairs generally do not suffer from impermanent loss, however, there are depeg risks, potentially leading to catastrophic loss. And most crypto assets simply have high volatility.

All positions are in profit. Filtered by: large positions in rETH/WETH pools.

3. Hedging by buying positive gamma payoffs

Uniswap v3 concentrated liquidity positions have payoffs similar to selling options. Clearly, one way to hedge that is by buying options.

Alternatives to options include power perpetuals, and using some other DeFi protocols like Smilee Finance and GammaSwap. Some of these ideas will be discussed in upcoming articles.

Dynamic re-hedging

But what if I told you that no exotic financial instruments are required to hedge LP positions with an almost perfect accuracy? It is sufficient to rebalance the hedge whenever the price changes.

Let say the pools has asset A and asset B, and the position is hedged, for example by using borrowed assets to LP.

  • If the price of A relative to B moves a bit, the hedge almost perfectly covers the position, and the loss or gain from the price move is low.
  • If the price moves a lot, the hedge is out of sync with the assets in the pool, so it stops being a good hedge for the position.

Rebalancing the hedge on price changes is of course not without costs. Rebalancing requires trading; trading requires paying swap fees and transaction fees (if on-chain). On the other hand, the divergence loss can be made as small as required by rebalancing frequently enough.

Example strategy

Let’s look at the DeFi-native strategy of hedging via borrowing. It requires more upfront capital than hedging via perpetuals, but is relatively safe and easy to execute.

Alice starts with 5000 USDC and provides liquidity in the USDC/ETH pool. The initial price of ETH is 1000 USDC.

Alice puts 4000 USDC in Aave, borrows 1 ETH, puts assets in 50:50 proportion in a full-range Uniswap position.

The initial capital is 5000 USDC, which is divided among the hedge (with value 3000 USDC) and the pool (value 2000 USDC):
V_collateral = 4000
V_debt = 1000
V_hedge = 4000–1000 = 3000
V_capital = V_pool + V_hedge = 5000

The price of ETH increases two times and reaches 2000 USDC. Now the value in the pool is 2000 · sqrt(2) USDC, but the value of the hedge decreases to 2000 USDC:
V_collateral = 4000
V_debt = 2000
V_hedge = 4000–2000 = 2000
V_capital = V_pool + V_hedge = 2000
·(1 + sqrt(2)) = 4828 USDC

There’s 3.4% loss relative to the initial capital. There are no hedging costs except opportunity costs, since borrowing fees are unlikely to exceed the APR from lending.

Bob starts with the same initial capital and the same strategy. However, when ETH price reaches $1500, Bob notices that the liquidity now contains less than 1 ETH, so some of the borrowed ETH can be repaid while keeping the position fully hedged. Bob removes some USDC from Aave, swaps them for ETH, repays the ETH, so that amount of ETH borrowed is exactly equal to the amount of ETH in the liquidity position. When ETH price reaches $2000, Bob’s portfolio still has some loss, but his loss is lower than Alice’s.

The intuitive explanation why is this: if Alice wants to repay the loan now, she has to buy ETH at $2000, while Bob bought some ETH at $1500.

However, if the price changes from $1500 to $1000 per ETH again, Bob has incurred transaction costs and swap costs, while Alice has not. Additionally, after this price decrease Bob has to rebalance in the opposite direction: he borrows some more ETH, sells that for USDC, and puts the USDC as a collateral in Aave.

Mathematical formalization

Let’s use P0 to denote the initial price, P the current price, R the ratio between these two prices (R:=P/P0), V0 the initial value of the LP or HODL position. Then for different HODL portfolios:

V_HODL_100(R) = V0 ·R
V_HODL_50(R) = (V0 + V0
·R) / 2
V_HODL_0(R) = V0

Full range LP position’s value is:

V_LP(R) = V0 · sqrt(R)

If a hedge is used then the total value of the LP’s portfolio is:

V_portfolio(R) = V_LP(R) + V_hedge(R)

The divergence loss (impermanent loss) is defined as:

DL(R) = (V_LP(R) — V_HODL_50(R)) / V_HODL_50(R)

Solving this we get this familiar formula for divergence loss (impermanent loss) for Uniswap v2:
DL(R) = 2 · sqrt(R) / (1 + R) — 1

For Uniswap v3 divergence loss formulas check the article “Concentrated Liquidity Analysis in Uniswap V3”, section 3.2.

The value of DL is strictly negative, except when R=1.0, i.e. the price has reverted back to the initial price.

Now we can decompose the value of the LP position using the HODL position’s value and the divergence loss term:

V_LP(R) = V_HODL_50(R) + V_HODL_50(R) ·DL(R)

Let’s say that the goal is delta-neutral hedging. Then the hedge portfolio should be constructed so that it has inverse payoff to the HODL 50:50 portfolio:

V_hedge(R_H) := V0 — V_HODL_50(R_H)

Here R_H denotes the price ratio at which the hedge portfolio was constructed. If R = R_H, then this gives is a truly delta-neutral combined portfolio, meaning that small changes in the volatile asset’s price do not significant direct impact on the value of the portfolio.

V_portfolio(R) =

= V_HODL_50(R) + V_HODL_50(R) ·DL(R) + V_hedge(R) — hedging_costs

= V0 + V_HODL_50(R) · DL(R) — hedging_costs

Where:

  • The V_HODL_50(R) · DL(R) term (always zero or negative) describes the loss due to price change. When R=1.0 it’s equal to zero (good!). The term only depends on the change in price, not the price itself. By keeping the price change small this term can be kept close to zero, as it’s a non-linear function of the price change.
  • The hedging_costs term describe the costs to buy or sell the hedged asset and mainly consist of trading fees & price impact.

The idea is to rebalance the hedge every time R grows or decreases above some fixed threshold. Let’s call this threshold the rebalancing step.

Rebalancing step can be infinitely large. Then we don’t rebalance the hedge no matter how much R changes relative to R_H. The hedging costs are small (zero beyond setting up the initial hedge), but the divergence loss can get very big. This is the situation covered in the first article.

To keep the capital loss per step bounded, the LP rebalances their hedge every time the price has changed for more than the rebalancing step, in either direction. The hedging costs get larger as the step gets smaller, but the divergence loss term V_HODL_50(R) · DL(R) can be made as small as desired.

Choosing dynamic re-hedging frequency

The V_portfolio(R) value equation is sufficient to compute the metric we want: how hedge rebalancing step size impacts the portfolio’s value changes under price changes.

Formally, rebalancing more frequently makes the V_HODL_50(R) · DL(R) term smaller, but the hedging costs larger. Not rebalancing makes the costs zero, but the divergence loss as large as it gets.

Smaller rebalancing steps lead to lower losses. Rebalancing costs and LP fees earned not accounted in the figure. Initial asset price $100, initial value of the LP position $200.
With very small rebalancing steps, the divergence loss disappears. Rebalancing costs and LP fees earned not accounted in the figure. Initial asset price $100, initial value of the LP position $200.

The figure below shows the hedging costs, estimated via GBM simulations that assume 0.3% swap fee and no transaction fees. In full-range positions even small hedge rebalancing steps (1 to 2%) have low costs:

Yearly swap costs for re-hedging, as % of initial capital, Uniswap v2

With concentrated liquidity, the hedging costs are higher, but still small relative to the initial capital:

Yearly swap costs for re-hedging, as % of initial capital, Uniswap v3, price range: [P/1.5, P*1.5], no liquidity relocation.

The discussion so far has centered on delta-neutral full range positions. However, the same strategy can be applied to other payoffs. For example, only 50% of the required volatile asset could be borrowed. That would give a hybrid strategy with 1/2 of initial value following the sqrt(R) function, and the other 1/2 being delta-neutral.

Moreover, the borrowing amount itself could be a function of price. Let’s say that at the initial price the LP borrows 100% of the required volatile asset, but as the price goes up, they slowly reduce the borrowed assets to zero. If price goes below the initial price, do the opposite: borrow and swap for stablecoins more than 100% of the required asset. It shows up as a convex function in the graph below!

Partial and dynamic hedging, compared with a HODL strategy. Step size=1%. Earned fees are not shown.

Another note: for Uniswap v3 positions with a fixed price range, rebalancing the hedge should be combined with relocating with liquidity in the pool.

Key takeaways

  1. By hedging and periodically rebalancing the hedge, LP can protects their capital from both price decrease and price increase. Delta-neutral strategies are possible.
  2. The LPs can minimize divergence loss if they use “price changes for x%” as a trigger for hedge rebalancing process.
  3. The smaller is the price step used to trigger an update of the hedge, the smaller is the remaining divergence loss. However, using a smaller rebalancing step leads to higher operational costs.

Acknowledgements. This work received financial support from the Uniswap Foundation. Thanks to Nikos Baxevanis for a review.

Disclaimer. This post is for general information purposes only. It does not constitute investment advice or a recommendation or solicitation to buy or sell any investment and should not be used in the evaluation of the merits of making any investment decision. It should not be relied upon for accounting, legal or tax advice or investment recommendations. This article was written in the author’s free time and is not related to his professional activity or his employer. This post reflects the current opinions of the author, which are subject to change without being updated.

--

--