Table of Contents
Fetching ...

ZeroSwap: Data-driven Optimal Market Making in DeFi

Viraj Nadkarni, Jiachen Hu, Ranvir Rana, Chi Jin, Sanjeev Kulkarni, Pramod Viswanath

TL;DR

This paper proposes the first optimal Bayesian and the first model-free data-driven algorithm to optimally track the external price of the asset, and empirically demonstrates the robustness of these algorithms to changing market conditions.

Abstract

Automated Market Makers (AMMs) are major centers of matching liquidity supply and demand in Decentralized Finance. Their functioning relies primarily on the presence of liquidity providers (LPs) incentivized to invest their assets into a liquidity pool. However, the prices at which a pooled asset is traded is often more stale than the prices on centralized and more liquid exchanges. This leads to the LPs suffering losses to arbitrage. This problem is addressed by adapting market prices to trader behavior, captured via the classical market microstructure model of Glosten and Milgrom. In this paper, we propose the first optimal Bayesian and the first model-free data-driven algorithm to optimally track the external price of the asset. The notion of optimality that we use enforces a zero-profit condition on the prices of the market maker, hence the name ZeroSwap. This ensures that the market maker balances losses to informed traders with profits from noise traders. The key property of our approach is the ability to estimate the external market price without the need for price oracles or loss oracles. Our theoretical guarantees on the performance of both these algorithms, ensuring the stability and convergence of their price recommendations, are of independent interest in the theory of reinforcement learning. We empirically demonstrate the robustness of our algorithms to changing market conditions.

ZeroSwap: Data-driven Optimal Market Making in DeFi

TL;DR

This paper proposes the first optimal Bayesian and the first model-free data-driven algorithm to optimally track the external price of the asset, and empirically demonstrates the robustness of these algorithms to changing market conditions.

Abstract

Automated Market Makers (AMMs) are major centers of matching liquidity supply and demand in Decentralized Finance. Their functioning relies primarily on the presence of liquidity providers (LPs) incentivized to invest their assets into a liquidity pool. However, the prices at which a pooled asset is traded is often more stale than the prices on centralized and more liquid exchanges. This leads to the LPs suffering losses to arbitrage. This problem is addressed by adapting market prices to trader behavior, captured via the classical market microstructure model of Glosten and Milgrom. In this paper, we propose the first optimal Bayesian and the first model-free data-driven algorithm to optimally track the external price of the asset. The notion of optimality that we use enforces a zero-profit condition on the prices of the market maker, hence the name ZeroSwap. This ensures that the market maker balances losses to informed traders with profits from noise traders. The key property of our approach is the ability to estimate the external market price without the need for price oracles or loss oracles. Our theoretical guarantees on the performance of both these algorithms, ensuring the stability and convergence of their price recommendations, are of independent interest in the theory of reinforcement learning. We empirically demonstrate the robustness of our algorithms to changing market conditions.
Paper Structure (29 sections, 14 theorems, 69 equations, 20 figures, 2 algorithms)

This paper contains 29 sections, 14 theorems, 69 equations, 20 figures, 2 algorithms.

Key Result

theorem 1

Let the external price $p_{ext}\sim \mathcal{D}$ jump to the value $p_{ext}^*$ only once at $t=0$, where the distribution $\mathcal{D}$ of the jump is known to the market maker. Then the Bayesian algorithm alg:bayes recommends ask and bid prices $p_a^t,p_b^t$ such that where the rate of convergence is exponential in $t$. Further, we also have

Figures (20)

  • Figure 1: The conjectured reward for the model-free algorithm trains the agent to track the external hidden price, eventually approaching the performance of the optimal Bayesian algorithm. Figure reference in sec:sim_res.
  • Figure 2: Even in the presence of erratic changes in the market conditions (Figure (a)), our data-driven algorithm for market making tracks the external hidden price with no prior training (Figure(b))
  • Figure 3: Algorithm alg:qt gives us comparable monetary loss per trade as running the algorithm with an oracle. The Bayesian algorithm alg:bayes gives loss close to zero, which is optimally efficient. All plots are averaged over values of informedness $\alpha$.
  • Figure 4: The performance of all algorithms is robust to changes in the number of trades the algorithm processes at every time step - this is a proxy for block latency
  • Figure 5: Augmenting the constant product market maker with our algorithms avoids the arbitrage loss and incurs a slight profit to liquidity providers
  • ...and 15 more figures

Theorems & Definitions (22)

  • theorem 1
  • theorem 2
  • theorem 3
  • corollary 1
  • lemma 1
  • proof
  • lemma 2
  • proof
  • lemma 3
  • proof
  • ...and 12 more