Hedging Uniswap v3 with SQUEETH

Joseph Clark
Opyn
Published in
6 min readDec 16, 2021

--

Uniswap LP hedged with SQUEETH

Opyn has invented and is about to ship a new DeFi primitive called SQUEETH (squared ETH) that improves hedging for non-linear things like AMM pools. Here we’ll use SQUEETH to hedge a USDC/ETH Uniswap v3 liquidity position.

TLDR: the hedge holds remarkably well. Practically, now it is possible to have a hedged Uniswap position with almost no impermanent loss.

Uni v3 and “impermanent loss”

We can see how the SQUEETH hedge works with pictures. The first chart shows the value of a Uniswap LP position as a function of ETH price. LPing USDC/ETH is long ETH, but less so as ETH goes up. This is because the pool sells ETH as ETH goes up. The second chart shows the difference between price movements for the LP and for the hedge. If ETH is at 4000 and we hedge with futures, the hedge will be approximately right for small changes, but gets worse for larger changes in each direction.

The crypto community calls the difference “impermanent loss.”

Uniswap LP value
“Impermanent” loss

To hedge this remaining risk (yellow line in the second chart) we use our SQUEETH quadratic contract. The hedge is straightforward, but we make use of some results about Uniswap v3, so have a look at our paper here for specifics.

The financial intuition for the shape of impermanent loss is that the Uniswap mechanism gives you more of the asset that performs worse (this is why it’s negative), and even more as it performs even worse (this is the curvature).

The mathematical intuition is that after removing a the linear component of a function you are left with quadratic and higher order terms. This is why we can quite accurately hedge any non-linear exposure with a linear instrument (futures) and a quadratic instrument (SQUEETH).

Uni v3 hedge process

Here’s how to hedge a Uniswap position with SQUEETH:

Step 1: Buy an amount of SQUEETH with the same curvature (gamma) as the Uniswap position

Step 2: Sell ETH perp futures (of the type traded on dydx or FTX) to hedge the slope (the ETH exposure) from Uniswap position and SQUEETH

The resulting position will still have some leftover cubic and higher order terms, but those have a small impact. The hedge holds remarkably well.

Consider the Uniswap v3 position below. Our aim is to hold a portfolio of SQUEETH and perps that offsets the change in the price of ETH.

A Uniswap LP that we want to hedge

Uniswap value and greeks

Opyn will give a calculator to give the size of the hedge for Uniswap LPs so this can safely be skipped if you’re not into this kind of thing. A more thorough development is in our paper here.

This position has a virtual liquidity L² = 1404.17². The value of a Uniswap position bounded between (3747, 5024) at price 4360.61 is

The greeks are:

Squeeth value and greeks

Squeeth is ETH² adjusted for funding. For our purposes we can just see it as the ETH price squared:

The greeks are:

Uniswap with a delta and gamma hedge

To fully hedge the position we need to:

  • Buy 0.0012 SQUEETH* (half the option gamma since SQUEETH gamma is 2) to hedge the gamma from the Uniswap position.
  • Sell 10.59 ETH futures to hedge the delta from SQUEETH
  • Sell 1.4435 ETH futures to hedge the delta from the Uniswap position

The table and figure below shows how the hedge works. The Uniswap pnl is hedged almost perfectly (to within about 1% accuracy) with the SQUEETH hedge.

Uniswap LP hedged with SQUEETH

Uniswap LP hedged with SQUEETH in Green. Almost no IL!

Converting to oSQTH for trading

The tradable version of SQUEETH is adjusted for accumulated funding payments, so we need to do a conversion to get a quantity to trade.

Funding is recorded in the contract with single number called the normalization factor. If the normalization factor is 0.7 we adjust by 10000/0.7 to get the amount of oSQTH. In the example we need 0.0012 * 10000/ 0.7 = 17.14 oSQTH for the hedge.

Four caveats for the hedge

Along with a usual disclaimer about this not being financial advice, there are a few things to keep in mind when doing this kind of hedge.

Caveat 1: O(x³)

Zooming in on the hedging error reveals something that looks like x³, and is actually x³, x⁴, x⁵ … in increasingly small quantities. This is so because we’ve only hedged x¹ (futures) and x² (SQUEETH).

Hedge error is O(x³)

Caveat 2 : Range awareness

Uniswap v3 positions have no gamma outside of the range, so the hedge needs to reduce to zero. Practically this means you need to run wide ranges or rebalance frequently to ensure the SQUEETH gamma has some Uniswap gamma to hedge.

Caveat 3: Funding costs

Under normal circumstances SQUEETH will pay funding from long positions to short. This funding cost is what you are paying for the hedge, and should be fair, but you need to make sure that the funding cost is offset by fees.

There is a deep principle here concerning volatility. A Uniswap pool implicitly prices the volatility of its component assets through the amount of fees. Squeeth also implicitly prices volatility through its funding rate. The hedge will work if Uniswap is implicitly pricing a higher volatility than SQUEETH.

Caveat 4: Changes in the value of SQUEETH over time

Over time the price of oSQTH will change due to accumulated funding, so to maintain a hedge you’ll have to check in occasionally and rebalance to maintain the same amount of gamma.

A hint at a general hedging framework

There is a more general pattern to hedge any function payoff with a combination of a futures and a quadratic hedge — the first two terms of the Taylor series for the value of a pricing function V:

If we need the higher order terms we have THREETH (ETH³ ), and TETREETH (ETH⁴), etc. But the first two terms get us most of the way there, and this is why we chose SQUEETH as the first deployment.

*A SQUEETH is the pure unit of squeeth which is traded with oSQTH which includes accumulated funding. It’s a bit easier to think in terms of SQUEETH to size hedges and convert to oSQTH at the end.

Acknowledgements: Alexis Gauba, Zubin Koticha, Andrew Leone, Wade Prospere

--

--