Batch Trading & Function-Maximizing AMMs

Background

In traditional financial markets, trading is primarily conducted through order book systems, where liquidity providers place buy and sell quotes to facilitate trades. These markets face significant challenges due to the presence of high-frequency traders (HFTs). One critical issue is "sniping stale quotes." Liquidity providers maintain quotes around an equilibrium price, but when market conditions change, these quotes can become stale. HFTs race to exploit these stale quotes before liquidity providers can cancel them, leading to inefficiencies. In anticipation, liquidity providers widen their spreads to protect themselves, which reduces overall market liquidity.

To address these inefficiencies, the financial industry has explored the concept of batching trades. Instead of continuous trading, time is divided into discrete intervals or batches. Orders arriving within the same batch are processed without prioritizing speed, encouraging traders to compete on price rather than speed. Batching trades eliminates latency races in traditional finance by changing the nature of competition between arbitrageurs.

There is a strong similarity between LVR and high frequency trading (HFT) in the traditional orderbook markets. The research paper titled Arbitrageursโ€™ profits, LVR, and sandwich attacks: batch trading as an AMM design response aims to adapt the concept of batching from traditional markets to DeFi AMMs and address:

  1. CFAMMs trading at a loss whenever there is a rebalancing event similar to sniping stale quotes".

  2. Traders are routinely exploited by attackers, most commonly via sandwich attacks in which an attacker front-runs a victimโ€™s swap with the same swap and then back-runs it with the opposite swap.

Proposed Design: High-Level Overview

The proposed design leverages batching to enhance trade fairness and efficiency, while expanding the design possibilities for AMMs to create more dynamic and effective liquidity provision mechanisms. It incorporates two key elements: Batching and a Function-maximizing AMM.

  1. Batching Trades:

    • Off-Chain Collection: The system collects trading intents off-chain, which reduces the load on the blockchain and allows for more efficient trade processing.

    • Batch Processing: Once trades are collected, they are batched together. Within a batch, trades are settled peer-to-peer as much as possible to maximize efficiency. Any remaining trades that cannot be settled directly are processed through an AMM that is accessible only to the batch.

    • Uniform Pricing: By ensuring that all trades within the same batch for the same token have the same price, we eliminate opportunities for traders to exploit price differences, thereby enhancing market fairness and stability.

  2. Expanded AMM Design Space:

    • Path Independence: In traditional AMMs, ensuring path independence is crucial to prevent traders from gaining an unfair advantage by splitting their trades. Our batching mechanism naturally prevents this type of exploitation, allowing us to explore a broader range of AMM designs.

    • Function-Maximizing AMM: An FM-AMM refers to a type of automated market maker (AMM) that maintains clearing-price consistency. This means that for every trade executed within this AMM, the average price is designed to be equal to the marginal price after the trade is completed. This flexibility allows the AMM to adapt more dynamically to market conditions, potentially providing better liquidity and more efficient trading outcomes. This innovative AMM design aims to maximize a specific function of its liquidity reserves with each trade. The simplest version of this is maximizing the product of the reserves, but the design can be extended to maximize any function of the reserves.

The function-maximizing AMM

Properties of an FM-AMM

  • Comparative Analysis: Comparing the FM-AMM to its CPAMM counterpart reveals notable disparities. While the FM-AMM generates twice the price impact per trade, it also implements a passive investment strategy, wherein the total value of reserves is evenly distributed between assets. This strategic positioning enhances the FM-AMM's efficacy in capital deployment and risk management.

Why batching trades is necessary?

FM-AMM vs CFMM (similar fee structure)

  • For the largest and most traded Uniswap v3pools, providing liquidity is unprofitable as trading fees don't compensate for arbitrage losses.

  • In pools with less-traded tokens, results vary, with Uniswap v3 outperforming FM-AMM on some pairs, but the absolute difference in cumulative returns is generally small.

FM-AMM fees

  • Fee and Arbitrage: Higher fees can also reduce the likelihood of arbitrageurs rebalancing the pool.

  • Optimal Fee: In many cases, a zero fee is optimal, leading to more frequent rebalancing and potentially higher returns. However, exceptions exist where a positive fee might be better.

FM-AMM with noise trading

Heimbach et al. (2024) identifies 30% of the total volume on Unswap v3 as non-atomic arbitrage. Also, according to labeling by https://zeromev.org/, sandwich attack and atomic arbitrage volume correspond to 6% of Unswap v3 volume. When extrapolated from Unsiwap v3 in general to the studied pools, then in each of the pools studiedFM-AMM, approximately 60% of trading volume is noise trading.

Attack Model

Conclusion

Last updated