ZeroSwap: Data-driven Optimal Market Making in DeFi (2310.09413v3)
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.
- Cowswap docs. https://docs.cow.fi/overview/coincidence-of-wants. Accessed: 2023-09.
- Discrimination of toxic flow in uniswap v3. https://crocswap.medium.com/discrimination-of-toxic-flow-in-uniswap-v3-part-1-fb5b6e01398b. Accessed: 2023-09.
- Dodo integrates chainlink live on mainnet, kickstarts the on-chain liquidity revolution. https://blog.dodoex.io/dodo-integrates-chainlink-live-on-mainnet-kickstarts-the-on-chain-liquidity-revolution-ee27e136e122. Accessed: 2023-09.
- Eigenlayer whitepaper. https://docs.eigenlayer.xyz/overview/whitepaper. Accessed: 2023-09.
- Flash loans aren’t the problem, centralized price oracles are. https://www.coindesk.com/tech/2020/11/11/flash-loans-arent-the-problem-centralized-price-oracles-are/. Accessed: 2023-09.
- https://cointelegraph.com/magazine/trouble-with-crypto-automated-market-makers/. Accessed: 2023-09.
- Optimism docs. https://community.optimism.io/. Accessed: 2023-09.
- Optimistic rollups. https://ethereum.org/en/developers/docs/scaling/optimistic-rollups/. Accessed: 2023-09.
- Order flow toxicity on dexes. https://ethresear.ch/t/order-flow-toxicity-on-dexes/13177. Accessed: 2023-09.
- Peter johnson and sai nimmagadda. the relentless rise of stablecoins. brevan howard digital. https://digify.com/a/#/f/p/ef09be008ee64ab68bda4f0a558302a2. Accessed: 2023-09.
- Random walk–1-dimensional, wolfram mathworld. https://mathworld.wolfram.com/RandomWalk1-Dimensional.html. Accessed: 2023-06.
- Uniswap v3 core. https://uniswap.org/whitepaper-v3.pdf. Accessed: 2023-09.
- Uniswap-v3 tvl comparison for stable coins vs non-stablecoins. https://defillama.com/protocol/uniswap-v3. Accessed: 2023-09.
- Constant function market makers: Multi-asset trades via convex optimization, 2021.
- Improved price oracles. In Proceedings of the 2nd ACM Conference on Advances in Financial Technologies. ACM, oct 2020.
- When does the tail wag the dog? curvature and market making, 2020.
- Jun Aoyagi. Liquidity provision by automated market makers, 2020.
- High frequency trading in a limit order book. Quantitative Finance, 8:217–224, 04 2008.
- An electronic market-maker. 01 2001.
- Qlammp: A q-learning agent for optimizing fees on automated market making protocols, 2022.
- Flash boys 2.0: Frontrunning, transaction reordering, and consensus instability in decentralized exchanges, 2019.
- Sanmay Das*. A learning market-maker in the glosten–milgrom model. Quantitative Finance, 5(2):169–180, 2005.
- Adapting to a market shock: Optimal sequential market-making. Advances in Neural Information Processing Systems, 21, 2008.
- SoK. In Proceedings of the 3rd ACM Conference on Advances in Financial Technologies. ACM, sep 2021.
- Optimal fees for geometric mean market makers, 2021.
- An axiomatic characterization of cfmms and equivalence to prediction markets. arXiv preprint arXiv:2302.00196, 2023.
- Bid, ask and transaction prices in a specialist market with heterogeneously informed traders. Journal of Financial Economics, 14(1):71–100, 1985.
- Finding the right curve: Optimal design of constant function market makers, 2023.
- Liquidity and market structure. The Journal of Finance, 43(3):617–633, 1988.
- Risks and returns of uniswap v3 liquidity providers. In Proceedings of the 4th ACM Conference on Advances in Financial Technologies. ACM, sep 2022.
- Thomas S. Y. Ho and Hans R. Stoll. The dynamics of dealer markets under competition. The Journal of Finance, 38(4):1053–1074, 1983.
- Stochastic variational inference, 2013.
- Arbitrum: Scalable, private smart contracts. In 27th USENIX Security Symposium (USENIX Security 18), pages 1353–1370, Baltimore, MD, August 2018. USENIX Association.
- Albert S. Kyle. Continuous auctions and insider trading. Econometrica, 53(6):1315–1335, 1985.
- Impermanent loss in uniswap v3, 2021.
- Diamonds are forever, loss-versus-rebalancing is not, 2022.
- Automated market making and arbitrage profits in the presence of fees, 2023.
- A myersonian framework for optimal liquidity provision in automated market makers, 2023.
- Automated market making and loss-versus-rebalancing, 2022.
- Playing atari with deep reinforcement learning, 2013.
- Vijay Mohan. Automated market makers and decentralized exchanges: a defi primer, 12 2020.
- Augmenting batch exchanges with constant function market makers, 2023.
- Generalizing impermanent loss on decentralized exchanges with constant function market makers, 2023.
- Q-learning. Machine learning, 8:279–292, 1992.
- Sok: Decentralized exchanges (dex) with automated market maker (amm) protocols. ACM Comput. Surv., 55(11), feb 2023.
- Viraj Nadkarni (7 papers)
- Jiachen Hu (12 papers)
- Ranvir Rana (8 papers)
- Chi Jin (90 papers)
- Sanjeev Kulkarni (20 papers)
- Pramod Viswanath (105 papers)