Adaptive Curves for Optimally Efficient Market Making

Authors Viraj Nadkarni , Sanjeev Kulkarni , Pramod Viswanath



PDF
Thumbnail PDF

File

LIPIcs.AFT.2024.25.pdf
  • Filesize: 0.97 MB
  • 22 pages

Document Identifiers

Author Details

Viraj Nadkarni
  • Princeton University, NJ, USA
Sanjeev Kulkarni
  • Princeton University, NJ, USA
Pramod Viswanath
  • Princeton University, NJ, USA

Cite AsGet BibTex

Viraj Nadkarni, Sanjeev Kulkarni, and Pramod Viswanath. Adaptive Curves for Optimally Efficient Market Making. In 6th Conference on Advances in Financial Technologies (AFT 2024). Leibniz International Proceedings in Informatics (LIPIcs), Volume 316, pp. 25:1-25:22, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2024)
https://doi.org/10.4230/LIPIcs.AFT.2024.25

Abstract

Automated Market Makers (AMMs) are essential in Decentralized Finance (DeFi) as they match liquidity supply with demand. They function through liquidity providers (LPs) who deposit assets into liquidity pools. However, the asset trading prices in these pools often trail behind those in more dynamic, centralized exchanges, leading to potential arbitrage losses for LPs. This issue is tackled by adapting market maker bonding curves to trader behavior, based on the classical market microstructure model of Glosten and Milgrom. Our approach ensures a zero-profit condition for the market maker’s prices. We derive the differential equation that an optimal adaptive curve should follow to minimize arbitrage losses while remaining competitive. Solutions to this optimality equation are obtained for standard Gaussian and Lognormal price models using Kalman filtering. A key feature of our method is its ability to estimate the external market price without relying on price or loss oracles. We also provide an equivalent differential equation for the implied dynamics of canonical static bonding curves and establish conditions for their optimality. Our algorithms demonstrate robustness to changing market conditions and adversarial perturbations, and we offer an on-chain implementation using Uniswap v4 alongside off-chain AI co-processors.

Subject Classification

ACM Subject Classification
  • Theory of computation → Market equilibria
Keywords
  • Automated market makers
  • Adaptive
  • Glosten-Milgrom
  • Decentralized Finance

Metrics

  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    0
    PDF Downloads

References

  1. 1inch protocol. 1inch dex aggreagator. https://1inch.io. Accessed: 2023-05.
  2. Guillermo Angeris, Akshay Agrawal, Alex Evans, Tarun Chitra, and Stephen Boyd. Constant function market makers: Multi-asset trades via convex optimization, 2021. URL: https://arxiv.org/abs/2107.12484.
  3. Guillermo Angeris and Tarun Chitra. Improved price oracles. In Proceedings of the 2nd ACM Conference on Advances in Financial Technologies. ACM, October 2020. URL: https://doi.org/10.1145/3419614.3423251.
  4. Guillermo Angeris, Alex Evans, and Tarun Chitra. When does the tail wag the dog? curvature and market making, 2020. URL: https://arxiv.org/abs/2012.08040.
  5. Jun Aoyagi. Liquidity provision by automated market makers, 2020. URL: https://ssrn.com/abstract=3674178.
  6. Ayana T. Aspembitova and Michael A. Bentley. Oracles in decentralized finance: Attack costs, profits and mitigation measures. Entropy, 25(1), 2023. URL: https://doi.org/10.3390/e25010060.
  7. Marco Avellaneda and Sasha Stoikov. High frequency trading in a limit order book. Quantitative Finance, 8:217-224, April 2008. URL: https://doi.org/10.1080/14697680701381228.
  8. Ashwath Balakrishnan. Understanding uniswap’s new liquidity aggregator (tl;dr at the end). https://members.delphidigital.io/feed/understanding-uniswaps-new-liquidity-aggregator-tldr-at-the-end, 2023. URL: https://arxiv.org/abs/2305.14604.
  9. The Block. Block.co trade volume comparisons. https://www.theblock.co/data/decentralized-finance/dex-non-custodial/uniswap-vs-coinbase-and-binance-trade-volume-7dma. Accessed: 2023-09.
  10. Brevis. Brevis website. https://docs.brevis.network/ . Accessed: 2023-05.
  11. centicio. Centralized exchange (cex) vs decentralized exchange (dex). which is the best crypto exchange? https://medium.com/@centicio/centralized-exchange-cex-vs-decentralized-exchange-dex-which-is-the-best-crypto-exchange-148f48ea51c1. Accessed: 2023-05.
  12. Nicholas Chan and Christian Shelton. An electronic market-maker, January 2001. Google Scholar
  13. Sitan Chen, Frederic Koehler, Ankur Moitra, and Morris Yau. Kalman filtering with adversarial corruptions. In Proceedings of the 54th Annual ACM SIGACT Symposium on Theory of Computing, pages 832-845, 2022. Google Scholar
  14. Dev Churiwala and Bhaskar Krishnamachari. Qlammp: A q-learning agent for optimizing fees on automated market making protocols, 2022. URL: https://arxiv.org/abs/2211.14977.
  15. CrocSwap. Discrimination of toxic flow in uniswap v3. https://crocswap.medium.com/discrimination-of-toxic-flow-in-uniswap-v3-part-1-fb5b6e01398b. Accessed: 2023-09.
  16. Diane Dai. 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.
  17. Sanmay Das*. A learning market-maker in the glosten-milgrom model. Quantitative Finance, 5(2):169-180, 2005. Google Scholar
  18. Sanmay Das and Malik Magdon-Ismail. Adapting to a market shock: Optimal sequential market-making. Advances in Neural Information Processing Systems, 21, 2008. Google Scholar
  19. A. P. Dempster, N. M. Laird, and D. B. Rubin. Maximum likelihood from incomplete data via the em algorithm. Journal of the Royal Statistical Society. Series B (Methodological), 39(1):1-38, 1977. URL: http://www.jstor.org/stable/2984875.
  20. Graham Elliott. Forecasting with trending data. Handbook of economic forecasting, 1:555-604, 2006. Google Scholar
  21. Shayan Eskandari, Mehdi Salehi, Wanyun Catherine Gu, and Jeremy Clark. SoK. In Proceedings of the 3rd ACM Conference on Advances in Financial Technologies. ACM, September 2021. URL: https://doi.org/10.1145/3479722.3480994.
  22. Alex Evans. Liquidity provider returns in geometric mean markets, 2020. URL: https://arxiv.org/abs/2006.08806.
  23. Alex Evans, Guillermo Angeris, and Tarun Chitra. Optimal fees for geometric mean market makers, 2021. URL: https://arxiv.org/abs/2104.00446.
  24. Rafael Frongillo, Maneesha Papireddygari, and Bo Waggoner. An axiomatic characterization of cfmms and equivalence to prediction markets. arXiv preprint, 2023. URL: https://arxiv.org/abs/2302.00196.
  25. Lawrence R. Glosten and Paul R. Milgrom. Bid, ask and transaction prices in a specialist market with heterogeneously informed traders. Journal of Financial Economics, 14(1):71-100, 1985. URL: https://doi.org/10.1016/0304-405X(85)90044-3.
  26. Mohak Goyal, Geoffrey Ramseyer, Ashish Goel, and David Mazières. Finding the right curve: Optimal design of constant function market makers, 2023. URL: https://arxiv.org/abs/2212.03340.
  27. SANFORD J. GROSSMAN and MERTON H. MILLER. Liquidity and market structure. The Journal of Finance, 43(3):617-633, 1988. URL: https://doi.org/10.1111/j.1540-6261.1988.tb04594.x.
  28. F. Gustafsson, F. Gunnarsson, N. Bergman, U. Forssell, J. Jansson, R. Karlsson, and P.-J. Nordlund. Particle filters for positioning, navigation, and tracking. IEEE Transactions on Signal Processing, 50(2):425-437, 2002. URL: https://doi.org/10.1109/78.978396.
  29. Lioba Heimbach, Eric Schertenleib, and Roger Wattenhofer. Risks and returns of uniswap v3 liquidity providers. In Proceedings of the 4th ACM Conference on Advances in Financial Technologies. ACM, September 2022. URL: https://doi.org/10.1145/3558535.3559772.
  30. Thomas S. Y. Ho and Hans R. Stoll. The dynamics of dealer markets under competition. The Journal of Finance, 38(4):1053-1074, 1983. URL: http://www.jstor.org/stable/2328011.
  31. Peter Johnson and Sai Nimmagadda. The relentless rise of stablecoins. https://digify.com/a/#/f/p/ef09be008ee64ab68bda4f0a558302a2. Accessed: 2023-09.
  32. Rudolph Emil Kalman. A new approach to linear filtering and prediction problems. Transactions of the ASME-Journal of Basic Engineering, 82(Series D):35-45, 1960. Google Scholar
  33. Harry Kalodner, Steven Goldfeder, Xiaoqi Chen, S. Matthew Weinberg, and Edward W. Felten. Arbitrum: Scalable, private smart contracts. In 27th USENIX Security Symposium (USENIX Security 18), pages 1353-1370, Baltimore, MD, August 2018. USENIX Association. URL: https://www.usenix.org/conference/usenixsecurity18/presentation/kalodner.
  34. Albert S. Kyle. Continuous auctions and insider trading. Econometrica, 53(6):1315-1335, 1985. URL: http://www.jstor.org/stable/1913210.
  35. DeFi Llama. Uniswap-v3 tvl comparison for stable coins vs non-stablecoins. https://defillama.com/protocol/uniswap-v3. Accessed: 2023-09.
  36. Stefan Loesch, Nate Hindman, Mark B Richardson, and Nicholas Welch. Impermanent loss in uniswap v3, 2021. URL: https://arxiv.org/abs/2111.09192.
  37. Christos Makidris. 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: 2023-09.
  38. F. Martinelli. Balancer whitepaper. https://balancer.fi/whitepaper.pdf. Accessed: 2023-05.
  39. Conor McMenamin, Vanesa Daza, and Bruno Mazorra. Diamonds are forever, loss-versus-rebalancing is not, 2022. URL: https://arxiv.org/abs/2210.10601.
  40. Raman K. Mehra. On the identification of variances and adaptive kalman filtering. IEEE Transactions on Automatic Control, 15:175-184, 1970. URL: https://api.semanticscholar.org/CorpusID:238574860.
  41. Jason Milionis, Ciamac C. Moallemi, and Tim Roughgarden. Automated market making and arbitrage profits in the presence of fees, 2023. URL: https://arxiv.org/abs/2305.14604.
  42. Jason Milionis, Ciamac C. Moallemi, and Tim Roughgarden. A myersonian framework for optimal liquidity provision in automated market makers, 2023. URL: https://arxiv.org/abs/2303.00208.
  43. Jason Milionis, Ciamac C. Moallemi, Tim Roughgarden, and Anthony Lee Zhang. Automated market making and loss-versus-rebalancing, 2022. URL: https://arxiv.org/abs/2208.06046.
  44. Beren Millidge, Alexander Tschantz, Anil Seth, and Christopher Buckley. Neural kalman filtering, 2021. URL: https://arxiv.org/abs/2102.10021.
  45. Vijay Mohan. Automated market makers and decentralized exchanges: a defi primer, December 2020. URL: https://doi.org/10.2139/ssrn.3722714.
  46. Viraj Nadkarni, Jiachen Hu, Ranvir Rana, Chi Jin, Sanjeev Kulkarni, and Pramod Viswanath. Zeroswap: Data-driven optimal market making in defi. arXiv preprint, 2023. URL: https://arxiv.org/abs/2310.09413.
  47. Viraj Nadkarni, Sanjeev Kulkarni, and Pramod Viswanath. Adaptive curves for optimally efficient market making. arXiv preprint, 2024. URL: https://arxiv.org/abs/2406.13794.
  48. Alex Nezlobin. Order flow toxicity on dexes. https://ethresear.ch/t/order-flow-toxicity-on-dexes/13177. Accessed: 2023-09.
  49. Optimism. Optimism docs. https://community.optimism.io/. Accessed: 2023-09.
  50. Axiom Protocol. Axiom client ciruit. https://docs.axiom.xyz/docs/axiom-developer-flow/axiom-client-circuit. Accessed: 2023-05.
  51. Axiom Protocol. Axiom website. https://docs.axiom.xyz/. Accessed: 2023-05.
  52. CoW protocol. Cowswap docs. https://docs.cow.fi/overview/coincidence-of-wants. Accessed: 2023-09.
  53. Gate protocol]. Offchain compute is all you need. https://www.gate.io/learn/articles/off-chain-compute-is-alll-you-need/1225. Accessed: 2023-05.
  54. Uniswap Protocol. Hooks on uniswap v4. https://docs.uniswap.org/contracts/v4/concepts/hook-deployment. Accessed: 2023-05.
  55. Uniswap Protocol. Uniswap v2 core. https://uniswap.org/whitepaper.pdf. Accessed: 2023-09.
  56. Uniswap Protocol. Uniswap v3 core. https://uniswap.org/whitepaper-v3.pdf. Accessed: 2023-09.
  57. Uniswap Protocol. Uniswap v4 docs. https://docs.uniswap.org/contracts/v4/concepts/intro-to-v4. Accessed: 2023-09.
  58. Uniswap Protocol. Uniswapx docs. https://blog.uniswap.org/uniswapx-protocol. Accessed: 2023-09.
  59. Palamarchuk Roman. Flash loan attacks: Risks and prevention. https://hacken.io/discover/flash-loan-attacks/. Accessed: 2023-05.
  60. Robert H Shumway and David S Stoffer. An approach to time series smoothing and forecasting using the em algorithm. Journal of time series analysis, 3(4):253-264, 1982. Google Scholar
  61. Rohan Tangri, Peter Yatsyshin, Elisabeth A. Duijnstee, and Danilo Mandic. Generalizing impermanent loss on decentralized exchanges with constant function market makers, 2023. URL: https://arxiv.org/abs/2301.06831.
  62. TheiaResearch. Better blockchains lead to more profitable liquidity providers. https://twitter.com/TheiaResearch/status/1790717593440952757. Accessed: 2024.
  63. Sebastian Thrun, Wolfram Burgard, and Dieter Fox. Probabilistic robotics. MIT Press, Cambridge, Mass., 2005. URL: http://www.amazon.de/gp/product/0262201623/102-8479661-9831324?v=glance&n=283155&n=507846&s=books&v=glance.
  64. Jo-Anne Ting, Evangelos Theodorou, and Stefan Schaal. Learning an outlier-robust kalman filter. In Joost N. Kok, Jacek Koronacki, Raomon Lopez de Mantaras, Stan Matwin, Dunja Mladenič, and Andrzej Skowron, editors, Machine Learning: ECML 2007, pages 748-756, Berlin, Heidelberg, 2007. Springer Berlin Heidelberg. Google Scholar
  65. Norbert Wiener. Cybernetics: or Control and Communication in the Animal and the Machine. MIT Press, Cambridge, MA, 2 edition, 1948. Google Scholar
  66. Jiahua Xu, Krzysztof Paruch, Simon Cousaert, and Yebo Feng. Sok: Decentralized exchanges (dex) with automated market maker (amm) protocols. ACM Comput. Surv., 55(11), February 2023. URL: https://doi.org/10.1145/3570639.
  67. Adelyn Zhou. 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.
  68. K. Zhou, J.C. Doyle, and K. Glover. Robust and Optimal Control. Feher/Prentice Hall Digital and. Prentice Hall, 1996. URL: https://books.google.com/books?id=RPSOQgAACAAJ.
Questions / Remarks / Feedback
X

Feedback for Dagstuhl Publishing


Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail