Optimizing AMM: Who’s Benefiting and Who’s Hurting?

Automatic Market Maker (AMM), as an algorithmic solution that automates and systematizes human market makers, has been constantly explored and improved to provide a smoother trading experience and better profiting opportunities.

The Uniswap v3 update earlier this year and the recently launched Clipper are two examples of AMM improvements that target different issues. By taking a close look at the mechanisms of these two solutions mathematically, this article wants to explore how different AMMs are modeled to benefit different groups of people while inevitably compromising another, and how different approaches are adopted to welcome the next generation of crypto market participants.

AMM Optimization for Who?

AMM is used in decentralized exchange (DEX) to systematically rationalize the interactions between the market maker algorithm and market participants. And the defining feature for an AMM is its invariant function, for example, the famous x*y = k in Uniswap.

The goal of AMM optimization is to seek a proper balance between the competing aims to profit and averse risks for market participants, eventually leading to a self-sustaining system to fulfill the emerging needs.

Figure 1. The positive feedback loop most believes AMM should adopt, namely a larger liquidity pool and smaller slippage.
Figure 1. The positive feedback loop most believes AMM should adopt, namely a larger liquidity pool and smaller slippage.

The two major participants in the market are traders and liquidity providers (LPs):

  • Liquidity providers supply liquidity pools with crypto tokens, whose prices are determined by the abovementioned invariant function. LPs mainly care about transaction fees (gains and incentives), impermanent loss, and capital efficiency.
  • Traders swap tokens from one to the other mediated by the liquidity pools. They care mostly about slippage loss (risks), transaction fees and gas (costs), and arbitrage opportunities.

While Uniswap v3 update increases capital efficiency for LPs by giving them granular control over what price ranges their capital is allocated to, Clippers makes effort to decrease the transaction costs for small-to-medium-sized traders by capping the size of the liquidity pool.

The Core Improvement of Uniswap v3 Focuses on LPs

Improvements and features

  • Concentrated liquidity that increases LP’s capital efficiency
  • A more flexible transaction fee structure
  • UNI Governance is able to set transaction fee rates.
  • Price oracle that provides a more convenient way to query recent price, and liquidity oracle that can be used by external liquidity mining contract.

The core of Uniswap’s update from v2 to v3 is to boost the capital efficiency for LPs. Given that usually, only a small fraction of assets in the liquidity pool are used to facilitate trade, Uniswap v3 allows its LPs to fine-tune the price ranges of their capital allocation (called positions). In other words, LPs spend much less by selecting the right section of the invariant formula to achieve the same profiting outcome compared to Uniswap v2.

This article and the whitepaper provide great technical illustrations and explanations.

Figure 2. This diagram shows the key issue that Uniswap v3 tries to tackle, which is to increase LP’s capital efficiency.
Figure 2. This diagram shows the key issue that Uniswap v3 tries to tackle, which is to increase LP’s capital efficiency.

It is claimed that LPs can provide liquidity with up to 4000x capital efficiency relative to v2. But it is also worth noting that the actual increase depends almost entirely on LP’s personal decision-making. Balancer v2’s asset manager feature also targets the same issue that the assets in the pools are not efficiently used and vast amounts of capital are unnecessarily locked. They rely on permissionless asset managers to make investments of idle assets.

Clipper Takes Care of Small Traders

Improvements and features

  • Built for retail investors and small trade sizes (< $10K).
  • Fewer transaction fees required to provide sufficient yield to incentivize LPs due to capped liquidity pool.
  • Controlled slippage by introducing a new parameter into the AMM model.
  • Minimized gas through computationally inexpensive calculation on-chain.
  • One consolidated pool for multi-assets that brings capital efficiency than fragmented liquidity across two-asset pools.
  • Updating the price of assets via external oracles instead of relying exclusively on arbitrageurs, further reducing impermanent loss

Small Traders are Hurting

Clipper aims for a DEX for retail traders* *and focuses on tackling high-liquidity-induced high transaction fees. While most people believe that a DEX with a larger liquidity pool and lower slippage loss is a better world for all, Clipper argues counterintuitively that it hurts the retail traders. Retail traders are missed out in this race for more liquidity and actually subsidize the whales as they are paying higher transaction fees without material benefit from lowered slippage, which cannot offset the fee rate rise.

How Come Lowering Slippage Is Not Always Good Enough?

Lowering slippage by enlarging the liquidity pool is not always good enough because we also need to take consequential higher transaction fees into consideration. Usually, the case is the larger the trading size, the more sensitive the traders are to the slippage relative to fees.

Figure 3. The Comparative Impact of Slippage and Trading Fee for Different Trading Size. Assuming: 1. we have a two-asset liquidity pool with equal wealth for both tokens (50/50); 2. the invariant formula is the classic CPMM; 3. the trading fee is 0.2% (as adopted by Clipper while Uniswap v2 is 0.3%). Impact Factor = Trading Fee / Slippage Loss. When Impact Factor > 1, traders are more sensitive to trading fees; and vice versa. The trading size is measured by the percentage of asset wealth being traded. From the plot, we can tell that if you are a trader trading less than 0.2% of the asset wealth, you probably want to care more about the trading fee than the slippage.
Figure 3. The Comparative Impact of Slippage and Trading Fee for Different Trading Size. Assuming: 1. we have a two-asset liquidity pool with equal wealth for both tokens (50/50); 2. the invariant formula is the classic CPMM; 3. the trading fee is 0.2% (as adopted by Clipper while Uniswap v2 is 0.3%). Impact Factor = Trading Fee / Slippage Loss. When Impact Factor > 1, traders are more sensitive to trading fees; and vice versa. The trading size is measured by the percentage of asset wealth being traded. From the plot, we can tell that if you are a trader trading less than 0.2% of the asset wealth, you probably want to care more about the trading fee than the slippage.

This is a framework you can refer to when estimating whether you want to care more about lower trading fee or lower slippage based on your trading size.

Assuming we have two 50/50 pool that supports ETH-stablecoin swap. Pool A is $200M with a 0.3% trading fee rate. Pool B is $20M with a 0.2% trading fee rate. And you want to sell $10K value of ETH. You may want to consider the smaller pool with the lower transaction fee because your trading size (0.1% in Pool B and 0.01% in Pool A) is small enough for you to be more sensitive to the trading fee.

Clipper Wants to Initiate a Smaller-Sized Pool

In response, Clipper introduced an optimized AMM model with a capped multi-asset liquidity pool ($20M), a new invariant in the formula, and a few more computational modifications, based on Abe Othman’s 2021 paper, New Invariants for Automated Market Making. He is also the founder of Clipper and one of the first to discover and develop AMM since as early as 2012.

Figure 4. This diagram shows the key issue that Clipper tries to tackle, which is to decrease trader’s trading fees.
Figure 4. This diagram shows the key issue that Clipper tries to tackle, which is to decrease trader’s trading fees.

Why the 20M Cap?

Clipper worked out the $20M cap backwards mathematically by assuming that the transaction fee (0.2% fee rate) and the slippage can balance each other out for a $10K trade size in a CPMM (constant-product market makers) model used in Uniswap and Balancer. In other words, find the pool size that can satisfy the impact factor equaling 1 when making a $10K-value of trade. Please note that Clipper’s pool is multi-asset and currently contains ETH, WBTC, DAI, USDC, and USDT.

The calculation guarantees that a pool size of at least $20M can benefit traders that trade under $10K. Larger trades may suffer from larger slippage though.

This project raised a $4M equity round led by Polychain Capital, with participation from 0x Labs, 1inch, DeFi Alliance, and Quantstamp, as well as other investors such as MetaCartel DAO, Robert Leshner and Tarun Chitra from Robot Ventures, FJLabs, and Naval Ravikant.

And an additional $17M was pledged for its liquidity pool by Polychain, Nascent, Three Arrows Capital, Electric Capital, LD Capital, IOSG, and other angels. Another several million is reserved for the Clipper community members. Currently, the project is planning to open liquidity provision to the community and you can apply here.

Further Optimization: What is The New Parameter in the AMM Formula again?

In Othman’s 2021 paper, he generalized the classic AMM model (CPMM) used in DEXes such as Uniswap v2/v3 and Balancer, by introducing a parametritized family of n-asset invariants. The parameterized variant can effectively mitigate slippage, leading us to wonder what other potentiality this protocol has in the future.

Figure 5. Price slippage in basis points with different k parameters. The table is taken from Othman’s 2021 paper. According to the paper, prices slip proportional to both the k parameter and the fraction of wealth traded. However, how k is specifically used in Clipper has not been released yet.
Figure 5. Price slippage in basis points with different k parameters. The table is taken from Othman’s 2021 paper. According to the paper, prices slip proportional to both the k parameter and the fraction of wealth traded. However, how k is specifically used in Clipper has not been released yet.
Figure 6. The Effect of the New Parameter on Slippage for different trade sizes. The bigger the trade size, the better the parameter can mitigate the slippage effect.
Figure 6. The Effect of the New Parameter on Slippage for different trade sizes. The bigger the trade size, the better the parameter can mitigate the slippage effect.

As of today (Aug 20, 2021), the average trade size through Clipper is $7.00K and almost 70% of the trading volume comes from the 1INCH DEX aggregator. It is worth noting that with the trading volume only 0.1% that of Uniswap, Clipper has 1% users that of Uniswap.

Capturing Niche Opportunity

Good for all is often good for none. If something is beneficial for someone, the immediate question will have to be whether it is hurting someone else in the meantime.

Therefore, it is much appreciated to see the emergence of Clipper, who positions itself to meet the needs of the small traders and to solve problems for them. It is crucial to carve out a space for them as more and more people are flocking into the crypto world at this very moment.

As of today (Aug 20th, 2021), there were approximately 230,000 people (unique addresses) traded on DEX in the past 7 days, not particularly impressive, yet leaving much room for imagination regarding what will happen when retailer traders onboard the crypto ship.

Subscribe to mings.eth
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.