Gamma transforms: How to hedge squeeth using Uni V3

  • squeeth is a blockchain-native asset with a payoff where gamma = +2 at all prices
  • Single-tick Uniswap v3 LP positions can be used to hedge the gamma of payoff curves with positive convexity like squeeth
  • We demonstrate how to hedge any positive gamma instrument using a “Gamma transform”

You may have read one of the many articles describing how squeeth can be used to hedge options or a Uniswap v3 LP position. In this article, I describe how to do the opposite: how to use Uniswap v3 to perfectly hedge a squeeth, options, or any positive convexity instrument over an arbitrary range.

What is Gamma?

Gamma is a measure of the “convexity” of the value of an asset. An asset with a positive convexity will increase in value faster as its price increases, while an asset with negative convexity will see diminishing returns as its price increases. Here’s a graph showing how gamma affect asset pricing:

It also helps to understand Gamma from its formal definition as the second derivative of the value of an asset. Specifically, if the value V(S) of a financial instrument depends on the price S of an asset, then the Delta (∆) and Gamma (Γ) of V(S) are defined as:

So if Delta is the change in value as a function of price, then Gamma is defined as the change in Delta as a function of the price. So Delta is the slope of the payoff curve, and Gamma is the slope of the slope of the payoff curve.

We can visualize below the delta and gamma of a Call option (an asset with positive convexity) by looking at the slope and curvature of each function:

Payoff, delta, and gamma for a 7dte long call option. Gamma for call options is always position and is equal to a Gaussian function.

Gamma for defi primitives

The delta, gamma, and all the other “greeks” for options are all known and can be derived from the solution to the Black-Scholes model.

What are the greeks for defi-native financial instruments?

Squeeth: First, let’s look at squeeth, a recently released financial product by the Opyn team. Squeeth is a type of power perpetual whose return is equal to the square of the price of ETH (squeeth = square-eth). This means that the value of a squeeth is S² if the price of ETH is S.

Thus, the Delta of squeeth is 2*S and the Gamma is a constant 2. The squeeth payoff will look like a quadratic function with a linear Delta and a flat Gamma.

Payoff, Delta, and Gamma for a squeeth.

Uniswap v2: Another interesting financial primitive is a Uniswap v2 LP position. In that case, the value of the position is V(S) = 2L√S, so the delta and gamma values are L/√S and -L/2(√S)³. Note how both the delta and the gamma of a Uni v2 LP position “explode” as the price S goes to zero:

Payoff, Delta, and Gamma for a Uniswap v2 LP position.

Uniswap v3: To compute the delta and gamma of a Uni v3 LP position, we first start from the value of a Uniswap v3 LP position established between a lower price Pa and an upper price Pb. Then, if we compute the derivative of the payoff as a function of the price S, we obtain:

Here, K=√(priceUpper*priceLower) is the strike and r = √(priceUpper/ priceLower) is the range factor. No more explosions as the price goes to zero, nice! However, both Delta and Gamma are discontinuous when the price touches priceUpper or priceLower.

We show this behavior below by plotting the payoff, Delta, and Gamma of a Uniswap v3 LP positions for two different range factors — r=1.5 (top) and r=1.05 (bottom):

Payoff, Delta, and Gamma for a Uniswap v3 LP position with a relatively wide range factor r = 1.5 (top) and one with a relatively narrow range factor r = 1.05 (bottom).

THE GAMMA TRANSFORM

What’s interesting in the previous analysis is that the Gamma of a single-tick Uni v3 position looks (almost) like a rectangle of width 2K*(r-1). To keep the area under that curve equal to unity, the height of that rectangle needs to be -1/(2K*(r-1)):

You can think of a single-tick position as a Kronecker delta, which is zero everywhere and equal to 1 at the current tick. Or it can also be seen as a bad approximation to a Dirac delta function.

Since each 1-tick wide LP positions have no overlap and they are all independent of one another, they can be used as the basis of what I call the Gamma Transform, which can be used to approximate any payoffs with negative convexity as the linear combination of several 1-tick positions.

Specifically, if Γ is the function to be recreated, then it can be expressed as a linear combinations of individual 1-tick positions |i> as

and

You may notice that I am using the bra-ket notation normally used in quantum physics. While there is nothing quantum about Uniswap v3 (or is there?), that notation makes it easy to keep track of all the terms in the expansion and compute the terms of the sum as:

Since a single-tick position can be approximated as having a vanishingly small width, we can assume that Γ(x) will be constant over the domain of integration. In that case, the expression for a_i reduces to:

The value of the a_i coefficients is directly proportional to the value of the functions’s gamma!

Using this, we can easily neutralize the constant gamma=2 of a squeeth between an arbitrary range (P_a=1.0001^a, P_b=1.0001^b) by deploying single-tick positions for which the liquidity at tick Ki is equal to the parameter a_i:

Deploying several narrow Uniswap v3 LP positions with liquidity given by 2Ki(r²-1)/r would result in a payoff function with gamma = -2 so that Gamma(squeeth) + Gamma(Uni-v3-hedge) = 0.

Graphically, we can see how accurate the gamma=-2 approximation gets if we add liquidity at progressively narrow ranges:

Combining 1, 2, 4 or 8 independent 1-tick positions to create a constant gamma payoff curve.

Focusing our attention to the delta and payoff of the 8 segment position (r = 1.05), we get:

The Uni v3 position will effectively hedge the gamma of a squeeth, but only between the lower and upper prices (Pa, Pb).

If one were to also neutralize the delta of the full position, one would need to short 2K ETH to neutralize the squeeth’s delta and another 2K(√r-1)/(r-1) to hedge the Uni v3 LP position (see here for more details).

Hence, by fully hedging a squeeth, we obtain a payoff AND a delta that looks flat across a fixed range. The figure below shows a fully hedged squeeth that uses 8 Uni v3 LP positions:

Payoff and delta of a hedged Uni v3 LP position (orange), a hedge squeeth (blue), and both of the combined (green).

While deploying 8 Uniswap v3 LP positions may result in a significant gas expenditures, one could create that type of position relatively easily using a custom smart contract that directly interacts with the Uniswap pools, or by a Decentralized Asset Management tool like Defiedge.io:

Deploying liquidity under 4 distinct ranges in one transaction using defiedge.io

Hedging any power perpetual and closing words

To summarize, here are the steps to neutralize both the delta and the gamma of a squeeth between a lower price Pa and an upper price Pb using N Uni v3 LP positions.

  1. Compute K = √(Pa*Pb) and r = √(Pb/Pa)
  2. Short 2K ETH to neutralize the squeeth delta
  3. Short 2K(√r-1)/(r-1) ETH to neutralize the Uni v3 delta
  4. Compute r0 = r^(1/N), that’s the width of the gamma basis |i>
  5. Compute (k0, k1, k2, …, kN) = (K/r*r0, K/r*r0³, K/r*r0⁵, …, K/r*r0^{2N-1}), that’s the location of each basis |i>
  6. Deploy N Uni v3 LP positions centered around (k0, k1, k2, …, kN), where the size of the position at “j” is 2*kj*(r0²-1)/r0

Why would someone want to hedge a long squeeth? I’m not entirely sure. While holding a squeeth means that one would need to pay a fixed funding rate, a net positive income may result from shorting ETH (if ETH is shorted on a perp futures exchange) and deploying a Uni v3 LP position (by collecting Uni v3 LP fees).

More generally, however, it is easy to see how this approach can be generalized to neutralize the gamma of any payoff function. For instance, the gamma of a call option is a gaussian, so a user would need to deploy LP positions with amounts of liquidity at each tick that follow a gaussian distribution.

Power perpetuals S^n with any exponent n larger than zero could similarly be hedged by computing the second derivative of S^n.

Log perpetuals? Exponential perpetuals? Binary options? The gamma for all of them could be hedged using Uni v3, as long as it is positive.

Happy hedging! 🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲

If you’re interested in these ideas please DM me on twitter @guil_lambert, visit https://www.yewbow.org, or send me an email to guil.lambert @ protonmail.com .

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Guillaume Lambert

Guillaume Lambert

Asst professor in Applied Physics at Cornell. LambertLab.io PI and proud father. Interests: Biophysics, Math, Crypto, and Options (often all at the same time).