Uniswap Insights Part 2 of 6

🦄 ck.eth 🦄
6 min readJun 6, 2023

In part 1 we looked into finding boundaries for capital efficiency. In this article we will look for boundaries when we are optimistic or pessimistic on price. We will finish with figuring out what we need to do to optimize for yield by constructing multiple LP positions within our boundary with the help of desmos.

The TLDR:

  1. Pick a directional bias by skewing the capital efficiency boundary.
  2. Slice the LP range into multiple LP positions to form a histogram.
  3. Save on gas costs. Rearrange LP positions one on top of another instead of lining them up to reduce the number of LP positions.
  4. Fit an LP position to your own distribution with desmos.

1. Pick Directional Bias

Recall that we solved for a way to balance capital efficiency while still maximizing an LP range in part 1 by setting an LP range to +/- 84%. The 84% boundary approach does not aim to optimize for yield and is not biased towards positive price movements. Let’s adjust our boundary for price direction bias by simply adding a parameter ’a’ for a skewed view on price.

Parameter alpha allows us to skew the efficiency boundaries of our LP position.

To get the original 84% bound in part 1 we have a=1 in blue above. If we think the returns will move twice as high up rather than down, we set a=2. See below a visualization of a=[0…3]

Our optimal efficiency bounds in percent for an LP position shift as we take a directional view on the price.

If we think the price is down only, we can set a=0 and even discover that 87% for the lower price range becomes the maximum boundary for capital efficiency. Providing liquidity beyond from the current price ratio is marginally inefficient.

See how changing price skew alpha impacts the lowest efficiency boundary: https://www.desmos.com/calculator/4zfw9vsnj0

As we increase skew to, say 5, our optimal peak shifts to 80% for the lower boundary while the upper boundary shifts to 5x80%=400%.

Visualizing boundaries for every possible directional bias is difficult in two dimensions, but if we create a third axis for the derivative of capital efficiency, we can look at where it peaks in three dimensions.

We can find our +/-84% and our -80%/+400% on the surface as well in red and green dots respectively.

Interactive 3D surface of f’(capital_efficiency): https://www.math3d.org/dxHSLpaZZ

The main takeaway is that setting the lower bound p_a to below 87% is marginally inefficient. For optimists the important takeaway is that the lower bound is not that sensitive to the skew. At a skew of 10 (you perceive that price could evolve 10% up for every 1% down) one still has a lower bound of 77%.

Depending on our level of optimism or pessimism of where the price can move, we can adjust our efficiency boundary with a desmos tool: https://www.desmos.com/calculator/0l7i8kmukx . Providing liquidity beyond the skewed range decreases the amount of bang for one’s buck.

Another approach to finding boundaries

Note that one can also solve for the maximum range based on how little capital one elects to deploy to a pool. We can solve the equation for capital efficiency backwards. For example, if one has a portfolio of $100, one may only want to risk deploying $20 and store the other $80 in a treasury bond yielding a fixed rate. The capital efficiency goal ‘E’ becomes $100/$20 = 5. What should the boundaries be given such a bias of a=2?

The equation for finding price bounds can be solved for x given a known y (capital efficiency).
We get p_a=-32% and p_b=64% with a capital efficiency of 5.

I’ve made the tool available for calculating efficiency bounds as well here: https://www.desmos.com/calculator/a8kt8g6kia

***

No matter which approach is used to find the boundaries, one can now work within these boundaries to optimize even further.

Well, how do we do that? Now comes the fun part. We are going to slice our LP position!

“We Slice the LP position”

-Jerry Seinfeld-

2. Chopping the range up into multiple LP Positions

Recall that price has the tendency to disperse as time goes on. This means that it does not conform to the shape of our rectangular range as we observe the price ratio over time. Instead the price distribution diffuses around the entry price kind of like this:

A stochastic process X eventually disperses over time. A single rectangle is not optimal for capturing yield.

As we move away from our starting price we would need to adjust the rectangular shape. The easiest way to do that is to split up our rectangular LP range into multiple ranges and make them fit inside a distribution. The LP position would be the integral within the efficiency boundary.

We add up the area between lower price bound and upper price bound using a Riemann integral with desmos doing all the calculations for us.
We use -32% and +64% from our previous example with capital efficiency at 5 and skew at 2.
Interactive tool available https://www.desmos.com/calculator/nab8lx6cbi. Gaussian distributions should not be relied on for outliers, we will go over better distributions in the future.

Notice how we created three LP positions with three weights. One would allocate capital in the ranges and weights defined in the desmos link. But this approach can be improved by slicing vertically (Lebesgue integral approach instead of Riemann).

Lebesgue approach is not as simple, but it can reduce gas and the number of LP positions. We will be going over how many times we should slice our LP position in Part 6.

Note how the Gaussian is just a basic toy distribution and does not represent some of the distributions you’d see in the real world. You could try plugging in fancier distributions into f(x). But note that the real world differs a bit:

WETH/USDT Liquidity Distribution. Note the tail.
MKR/ETH Note the skew, we would need to use asymmetry to capture this.

In order to capture these advanced distributions, we will need to learn more about liquidity fingerprints and use asymmetric log-Laplace distributions continued in part 3 here: https://medium.com/@med456789d/uniswap-insights-part-3-of-6-f49aa1e5523c.

  • If you found this educational, feel free to give this hedgehog a follow on twitter: @CK_2049

Disclaimer: This research is for general information purposes only. The Uniswap Foundation was kind enough to sponsor the publication of previously private research. 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 post reflects the current opinions of the author. The opinions reflected herein are subject to change without being updated.

--

--