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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
All code used for simulation in this section can be viewed anonymously at this link.
References
Cowswap docs. https://docs.cow.fi/overview/coincidence-of-wants. Accessed Sep 2023
Discrimination of toxic flow in Uniswap v3. https://crocswap.medium.com/discrimination-of-toxic-flow-in-uniswap-v3-part-1-fb5b6e01398b. Accessed Sep 2023
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 Sep 2023
Eigenlayer whitepaper. https://docs.eigenlayer.xyz/overview/whitepaper. Accessed Sep 2023
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 Sep 2023
Front running, bots, slippage, oracle pricing errors: AMMs are great, but there are problems. https://cointelegraph.com/magazine/trouble-with-crypto-automated-market-makers/. Accessed Sep 2023
Optimism docs. https://community.optimism.io/. Accessed Sep 2023
Optimistic rollups. https://ethereum.org/en/developers/docs/scaling/optimistic-rollups/. Accessed Sep 2023
Order flow toxicity on DEXES. https://ethresear.ch/t/order-flow-toxicity-on-dexes/13177. Accessed Sep 2023
Johnson, P., Nimmagadda, S.: the relentless rise of stablecoins. Brevan Howard Digital. https://digify.com/a/#/f/p/ef09be008ee64ab68bda4f0a558302a2. Accessed Sep 2023
Uniswap v2 core. https://uniswap.org/whitepaper.pdf. Accessed Sep 2023
Uniswap v3 core. https://uniswap.org/whitepaper-v3.pdf. Accessed Sep 2023
Uniswap-v3 TVL comparison for stable coins vs non-stablecoins. https://defillama.com/protocol/uniswap-v3. Accessed Sep 2023
Angeris, G., Agrawal, A., Evans, A., Chitra, T., Boyd, S.: Multi-asset trades via convex optimization, constant function market makers (2021)
Angeris, G., Chitra, T.: Improved price oracles. In: Proceedings of the 2nd ACM Conference on Advances in Financial Technologies. ACM (2020)
Angeris, G., Evans, A., Chitra, T.: When does the tail wag the dog? Curvature and market making (2020)
Aoyagi, J.: Liquidity provision by automated market makers (2020)
Avellaneda, M., Stoikov, S.: High frequency trading in a limit order book. Quant. Financ. 8, 217–224 (2008)
Chan, N., Shelton, C.: An electronic market-maker (2001)
Churiwala, D., Krishnamachari, B.: QLAMMP: a Q-learning agent for optimizing fees on automated market making protocols (2022)
Daian, P., et al.: Flash boys 2.0: frontrunning, transaction reordering, and consensus instability in decentralized exchanges (2019)
Das, S.: A learning market-maker in the Glosten–Milgrom model. Quant. Financ. 5(2), 169–180 (2005)
Das, S., Magdon-Ismail, M.: Adapting to a market shock: optimal sequential market-making. Adv. Neural Inf. Process. Syst. 21 (2008)
Eskandari, S., Salehi, M., Gu, W.C., Clark, J.: SoK. In: Proceedings of the 3rd ACM Conference on Advances in Financial Technologies. ACM (2021)
Evans, A., Angeris, G., Chitra, T.: Optimal fees for geometric mean market makers (2021)
Frongillo, R., Papireddygari, M., Waggoner, B.: An axiomatic characterization of CFMMs and equivalence to prediction markets. arXiv preprint arXiv:2302.00196 (2023)
Glosten, L.R., Milgrom, P.R.: Bid, ask and transaction prices in a specialist market with heterogeneously informed traders. J. Financ. Econ. 14(1), 71–100 (1985)
Goyal, M., Ramseyer, G., Goel, A., Mazières, D.: Optimal design of constant function market makers, finding the right curve (2023)
Grossman, S.J., Miller, M.H.: Liquidity and market structure. J. Financ. 43(3), 617–633 (1988)
Heimbach, L., Schertenleib, E., Wattenhofer, R.: Risks and returns of Uniswap v3 liquidity providers. In: Proceedings of the 4th ACM Conference on Advances in Financial Technologies. ACM (2022)
Ho, T.S.Y., Stoll, H.R.: The dynamics of dealer markets under competition. J. Financ. 38(4), 1053–1074 (1983)
Kalodner, H., Goldfeder, S., Chen, X., Weinberg, S.M., Felten, E.W. Arbitrum: scalable, private smart contracts. In: 27th USENIX Security Symposium (USENIX Security 18), pp. 1353–1370, Baltimore, MD, August 2018. USENIX Association (2018)
Kyle, A.S.: Continuous auctions and insider trading. Econometrica 53(6), 1315–1335 (1985)
McMenamin, C., Daza, V., Mazorra, B.: Diamonds are forever, loss-versus-rebalancing is not (2022)
Milionis, J., Moallemi, C.C., Roughgarden, T.: Automated market making and arbitrage profits in the presence of fees (2023)
Milionis, J., Moallemi, C.C., Roughgarden, T.: A Myersonian framework for optimal liquidity provision in automated market makers (2023)
Milionis, J., Moallemi, C.C., Roughgarden, T., Zhang, A.L.: Automated market making and loss-versus-rebalancing (2022)
Mohan, V.: Automated market makers and decentralized exchanges: a DeFi primer (2020)
Nadkarni, V., Jiachen, H., Rana, R., Jin, C., Kulkarni, S., Viswanath, P.: Data-driven optimal market making in DeFi, Zeroswap (2023)
Ramseyer, G., Goyal, M., Goel, A., Mazières, D.: Augmenting batch exchanges with constant function market makers (2023)
Tangri, R., Yatsyshin, P., Duijnstee, E.A., Mandic, D.: Generalizing impermanent loss on decentralized exchanges with constant function market makers (2023)
Watkins, C.J.H.C., Dayan, P.: Q-learning. Mach. Learn. 8, 279–292 (1992)
Xu, J., Paruch, K., Cousaert, S., Feng, Y.: SoK: decentralized exchanges (DEX) with automated market maker (AMM) protocols. ACM Comput. Surv. 55(11) (2023)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2025 International Financial Cryptography Association
About this paper
Cite this paper
Nadkarni, V., Hu, J., Rana, R., Jin, C., Kulkarni, S., Viswanath, P. (2025). ZeroSwap: Data-Driven Optimal Market Making in Decentralized Finance. In: Clark, J., Shi, E. (eds) Financial Cryptography and Data Security. FC 2024. Lecture Notes in Computer Science, vol 14744. Springer, Cham. https://doi.org/10.1007/978-3-031-78676-1_12
Download citation
DOI: https://doi.org/10.1007/978-3-031-78676-1_12
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-78675-4
Online ISBN: 978-3-031-78676-1
eBook Packages: Computer ScienceComputer Science (R0)