ZeroSwap++ : Adaptive Curves for Optimally Efficient Market Making

This is a short introduction to the problem tackled and the solutions outlined in a recent research paper of ours. We welcome any feedback, questions and further discussions. The following poster gives an even shorter overview of the work.

Authors:

  • Viraj Nadkarni - Princeton University Website
  • Sanjeev Kulkarni - Princeton University Website
  • Pramod Viswanath - Princeton University Website

Market making plays a crucial role in enhancing liquidity in financial systems. In traditional finance, effective market making strategies involve setting buy and sell prices (bid and ask quotes) as narrowly separated as possible, ensuring these quotes closely mirror the asset’s true price on a limit order book. This strategy enables market makers to earn a marginal profit. Such efficacy in market making is driven by sophisticated models that analyze trader behavior. These models have become fundamental in understanding the principles of microeconomics and the microstructure of markets.

Market Makers in DeFi In the field of Decentralized Finance (DeFi), the concept of automated market making has gained prominence. DeFi employs Automated Market Makers (AMMs), particularly Constant Function Market Makers (CFMMs), offering an alternative to traditional limit order books. This approach reduces the computational effort needed to facilitate trades and ensures liquidity is available for tokens that are less frequently traded. Unlike conventional markets that primarily utilize limit order books for Peer-to-Peer transactions, decentralized markets implement a Peer-to-Pool-to-Peer structure. In this model, Liquidity Providers (LPs) aggregate their resources in a contract, which traders then utilize to meet their liquidity needs. Thus, any DeFi market needs to incentivize both the LPs and the traders to ensure a fair and efficient market is created.

Market depth and volatility DeFi markets exhibit a range of distinct characteristics, primarily differentiated by market depth (or liquidity) and price volatility. Notably, the trading volume of stablecoins (approximately $11.1 trillion) has recently exceeded the transaction volumes of centralized entities like MasterCard and PayPal. Markets with significant liquidity, especially those trading stablecoins, are highlighted in this context. Such markets typically experience minimal volatility, and their substantial depth minimizes the price impact of retail trades. Conversely, DeFi features hundreds of infrequently traded tokens, which suffer from a lack of liquidity, leading to high volatility and price sensitivity to even small-scale retail trades. These markets are also susceptible to swings in price caused by flash loan transactions. This paper addresses the optimization of market making strategies for the latter (less liquid) kind of markets.

Incentives of LPs A key challenge for Constant Function Market Makers (CFMMs) is motivating Liquidity Providers (LPs) to contribute their tokens to the pool. For this incentive to work, it is crucial for CFMMs to minimize the average losses on pooled assets. Yet, it is widely acknowledged that LPs often incur losses due to fluctuations in reserves and a lack of market insights. This paper concentrates on reducing the losses that stem from such informational deficiencies. Specifically, static curves in CFMMs frequently lead to LP losses as a result of arbitrage activities. These losses are intended to be offset by transaction fees, contrasting with centralized exchanges which benefit from higher liquidity and trading volumes but impose lower fees. For example, Binance, a centralized exchange, records a daily trading volume of approximately $15 billion, significantly higher than Uniswap’s $1.1 billion, the largest decentralized exchange. The lower liquidity on platforms like Uniswap results in less current prices, making them more susceptible to arbitrage losses.

Arbitrage Loss The specific type of arbitrage loss known as loss-versus-rebalancing (LVR) can be quantified in certain scenarios, and these losses continue to occur despite the implementation of trading fees. In the case of a generic market maker who sets bid and ask prices for a volatile asset, arbitrage losses are defined relative to the asset’s true market price. An arbitrageur engages in a buy transaction when the market price surpasses the ask price, and in a sell transaction when it drops below the bid price. The resultant loss for the market maker is calculated as the product of the price difference and the volume of the asset traded.

Trader behavior In traditional financial systems, arbitrage-related losses are conceptualized as adverse selection costs, which arise from interactions with informed traders—those who are privy to the external market price, akin to arbitrageurs. A market maker achieves optimal operation by balancing these costs against the profits gained from uninformed traders, also known as noise traders. This balancing principle was first delineated by Glosten and Milgrom. Within the Decentralized Finance (DeFi) ecosystem, trading parties are differentiated into toxic and non-toxic order flows, which correspond to informed and uninformed traders, respectively. We extend this model to a more nuanced framework where traders are categorized along a continuous spectrum of information awareness, ranging from highly informed to completely uninformed, rather than being strictly classified as either toxic or non-toxic.

CFMMs as prediction markets For CFMMs, a significant portion of their losses also arises from the need to encourage traders to disclose their genuine price perceptions during transactions. In essence, CFMMs provide compensation to informed traders in exchange for their crucial market insights, which mirrors the principles of market scoring rules utilized in prediction markets to extract valuable information.

Conditions for optimality A straightforward approach to reduce losses to arbitrage would be aligning the marginal price exactly with the external market price, which would require real-time data from a price oracle. Yet, integrating oracles with market making strategies can lead to potential frontrunning risks and necessitates reliance on centralized, potentially manipulable external entities. To circumvent these issues, our framework explicitly excludes the use of oracles. The objective is to deduce the hidden market price by analyzing trade history data, aiming for maximum efficiency in terms of data utilization. Further, the market maker uses this to adaptively set its bonding curve so that the loss to arbitrageurs is as close to zero as possible, ensuring an optimally efficient market. The market maker turning a profit would be undesirable since this would allow a competitor to undercut its prices and take away their order flow. In other words, it should quote an efficient and competitive market price, given only the information it has in form of the trading history. Keeping this objective in mind, we outline the key contributions of this work.

Our contributions

Optimal algorithms for adapting curves (Section 4) We provide the differential equation that the demand curve of an optimally efficient market should follow (Theorem 1). When the statistics governing trader and price behavior are known and Gaussian/Lognormal, we show that this differential equation can be solved exactly using a dynamic bonding curve that changes its operating point using the Kalman Filter (Theorem 2 and Theorem 3).

Adapting to unknown market conditions When the statistics governing trader and price behavior are unknown, we extend the previous approach by using an Adaptive Kalman Filter. We empirically show that both these approaches suffer significantly lower arbitrage losses compared to a static CFMM. (Section 5.2)

Robustness to adversarial manipulation In presence of irrational traders that seek to make the price of the market maker deviate from the external market, we present a robust version of the adaptive curve algorithm that tolerates up to 50% of trader population being adversarial. (Section 5.3)

Comparisons with static curves (Section 6) We provide theoretical comparisons of static and the proposed adaptive curve models by showing that the error in the adaptive AMM price, when viewed as an oracle, decays with more trades, while that of a static curve remains unchanged (Theorem 4).

Implied dynamics of static curves (Section 6) We derive a differential equation that governs the implied dynamical model given the static CFMM curves that are used in practice. We show that these CFMMs can only be optimally efficient in a model where inter-block time for the underlying blockchain vanishes, the CFMM has more liquidity than the external market, and that the trader and price behavior is severely constrained. (Theorem 5)

On-chain Implementation We specify the end-to-end system design for our proposed market maker. Furthermore, we provide an implementation of our algorithm using the recently released Uniswap v4 platform and an off-chain machine learning co-processor Axiom. This co-processor provides guarantees that the algorithms derived in this work are executed, and the result is put securely on-chain. (Section 8)

11 Likes