## Abstract

With the emergence of decentralized finance, new trading mechanisms called automated market makers have appeared. The most popular Automated Market Makers are Constant Function Market Makers. They have been studied both theoretically and empirically. In particular, the concept of impermanent loss has emerged and explains part of the profit and loss of liquidity providers in Constant Function Market Makers. In this paper, we propose another mechanism in which price discovery does not solely rely on liquidity takers but also on an external exchange rate or price oracle. We also propose to compare the different mechanisms from the point of view of liquidity providers by using a mean/variance analysis of their profit and loss compared to that of agents holding assets outside of Automated Market Makers. In particular, inspired by Markowitz’ modern portfolio theory, we manage to obtain an efficient frontier for the performance of liquidity providers in the idealized case of a perfect oracle. Beyond that idealized case, we show that even when the oracle is lagged and in the presence of adverse selection by liquidity takers and systematic arbitrageurs, optimized oracle-based mechanisms perform better than popular Constant Function Market Makers.

### Similar content being viewed by others

## Data availability

We do not analyse any existing datasets but rather generate Monte–Carlo simulations.

## Notes

There exist AMMs functioning with pools involving more than two assets, but we focus on the two-asset case throughout this paper.

In particular (like for most DeFi applications) AMMs are fully collateralized and neither LPs nor LTs are exposed to any sort of counterparty risk. To be more precise, LPs are exposed to a technological—or cyber—risk, but as long as the smart contract works as expected, they will be able to withdraw reserves in line with their supply.

We refer to Mohan (2022) for a pedagogical introduction to CFMMs and the classical pricing functions. Examples of popular CFMMs include Uniswap (see Adams 2018, Adams et al. 2020; 2021), Balancer (see Martinelli & Mushegian 2019), Curve (see Egorov 2019; 2021), etc. An interesting empirical analysis of Uniswap v3 is Loesch et al. (2021).

This led to the now classical concept of impermanent loss that is widely used in the DeFi world. The “impermanent” trait of such loss lies in the fact that losses vanish when the exchange rate reverts back to its original value (at the time the liquidity was provided).

Due to the challenges posed by impermanent loss, much of the existing literature has sought to optimize AMM designs with a focus on LPs. Our work aligns with this perspective, drawing additional inspiration from research works on optimal market making in OTC markets, which predominantly consider the dealers’ standpoint. It is worth noting, however, that an economic perspective on AMM design should ideally encompass both LTs and LPs. In the below literature review, there are a few papers tackling equilibrium issues encompassing both LPs and LTs but not with designs like ours.

Hodl is slang in the cryptocurrency community for holding a cryptocurrency. In traditional finance, this would be called “buy and hold”.

When the price process is a martingale this is the Doob-Meyer decomposition of the payoff.

In the very recent paper (Milionis et al., 2023) they added transaction costs and discrete-time trading and obtained asymptotic results with respect to the frequency of blocks.

As in most papers of the literature, our analysis is valid between any two liquidity provision/redemption events. In other words, we assume that liquidity evolves according to the swaps placed by LTs only.

Of course, in the case of provision/redemption of liquidity, the quantity changes, hence the above footnote.

The strictness is important only to differentiate the Legendre transform of \(\psi \) below.

The PnL needs to be accounted in a given currency. We arbitrarily choose currency 0 in what follows.

We restrict the function to the interior of its domain.

\(\delta ^{0,1}(t,z)\) and \(\delta ^{1,0}(t,z)\) converted in basis points, could be regarded as “mid”-to-bid and ask-to-“mid” in basis points. Everything works indeed almost as if the prices proposed for swapping were respectively \(S_t (1-\delta ^{1,0}(t,z))\) (bid) and \(S_t (1+\delta ^{0,1}(t,z))\) (ask). While \(S_t\) serves as an indicative price independent of size

*z*, the ultimate exchange rate depends on the size (and direction) of the transaction.As in Milionis et al. (2023), one can argue that the term \(\int _0^T \mu Y^1_t dt + \int _0^T \sigma Y^1_t dW_t = \int _0^T (q^1_t - q^1_0) dS_t\) is theoretically hedgeable.

The parameter \(\gamma\) can be interpreted in two ways. One can see it as a risk aversion parameter or as a Lagrange multiplier, like in the Markowitz framework.

In pratice, the choice of \(\gamma \) should be contingent on the pool size and the level of liquidity. For example, a higher \(\gamma \) value might be suitable when the pool size is smaller and/or liquidity demand is high. Conversely, a reduced \(\gamma \) could be adopted when the pool is more substantial, and liquidity demand is lesser. Notably, the value of \(\gamma \) could be adjusted at each time of liquidity provision. In this paper, as in most of the literature, we analyse the PnL of LPs between two times of liquidity provision/redemption and \(\gamma \) is fixed.

In fact, in our numerical examples, we observe that, with the markups obtained using this approach, the reserves remain positive at all times, i.e., the constraints are not binding.

If continuous-time hedging with no friction was possible as in Milionis et al. (2023), the HJB equation would be Eq. (2) with \(\mu =0\) and \(\sigma =0\). This would lead to \(\theta (t,y) = C(T-t)\) for some constant

*C*independent of*y*and an optimal strategy independent of \(Y^1_t\). A softer way to consider the possibility to hedge could be, as in Barzykin et al. (2021), to add a term \(\sup _v v\partial _y \theta - L(v)\) with \(L: v \mapsto \psi |v| + \eta |v|^{1+\phi }\) an execution cost function as in the optimal execution literature. In particular, the cost of liquidity and the need to cross the spread would be modeled.For models taking account of the stochastic nature of volatility and liquidity, see Bergault et al. 2023.

Of course, these arbitrages come with a cost for arbitrageurs, who still have to pay the fees associated with a swap on another (centralized) exchange. In our case, we assume a proportional cost of \(7.5 \text { bps}\). Moreover, note that in our simulations, arbitrageurs trade a size that is optimal for them—and thus does not necessarily correspond to the size of the other trades.

## References

Abergel, F., Huré, C., & Pham, H. (2020). Algorithmic trading in a microstructural limit order book model.

*Quantitative Finance,**20*(8), 1263–1283.Adams, H. (2018). Uniswap whitepaper.

Adams, H., Zinsmeister, N., & Robinson, D. (2020). Uniswap v2 core, 2020.

Adams, H., Zinsmeister, N., Salem, M., Keefer, R., & Robinson, D. (2021). Uniswap v3 core.

Amihud, Y., & Mendelson, H. (1980). Dealership market: Market-making with inventory.

*Journal of Financial Economics,**8*(1), 31–53.Angeris, G., Agrawal, A., Evans, A., Chitra, T., & Boyd, S. (2021). Constant function market makers: Multi-asset trades via convex optimization. arXiv preprint arXiv:2107.12484.

Angeris, G., & Chitra, T. (2020). Improved price oracles: Constant function market makers. In

*Proceedings of the 2nd ACM Conference on Advances in Financial Technologies*, pages 80–91.Angeris, G., Evans, A., & Chitra, T. (2020). When does the tail wag the dog? Curvature and market making. arXiv preprint arXiv:2012.08040.

Angeris, G., Evans, A., & Chitra, T. (2021). Replicating market makers. arXiv preprint arXiv:2103.14769.

Angeris, G., Evans, A., Chitra, T., & Boyd, S. (2022). Optimal routing for constant function market makers. In

*Proceedings of the 23rd ACM Conference on Economics and Computation*, pages 115–128.Angeris, G., Kao, H.-T., Chiang, R., Noyes, C., & Chitra, T. (2019). An analysis of Uniswap markets. arXiv preprint arXiv:1911.03380.

Aoyagi, J. (2020). Liquidity provision by automated market makers.

*Available at SSRN 3674178*.Aoyagi, J., & Ito, Y. (2021). Coexisting Exchange Platforms: Limit Order Books and Automated Market Makers. In

*Limit Order Books and Automated Market Makers.*.Avellaneda, M., & Stoikov, S. (2008). High-frequency trading in a limit order book.

*Quantitative Finance,**8*(3), 217–224.Baldacci, B., Bergault, P., & Guéant, O. (2021). Algorithmic market making for options.

*Quantitative Finance,**21*(1), 85–97.Barbon, A., & Ranaldo, A. (2021). On the quality of cryptocurrency markets: Centralized versus decentralized exchanges. arXiv preprint arXiv:2112.07386.

Barzykin, A., Bergault, P., & Guéant, O. (2021). Algorithmic market making in foreign exchange cash markets: a new model for active market makers.

*Mathematical Finance,**33*(1), 41–79.Barzykin, A., Bergault, P., & Guéant, O. (2022). Market-making by a foreign exchange dealer.

*Risk Magazine*.Barzykin, A., Bergault, P., & Guéant, O. (2023). Dealing with multi-currency inventory risk in foreign exchange cash markets.

*Risk Magazine*.Bergault, P, Evangelista, D, Guéant, O, & Vieira, D. (2021). Closed-form approximations in multi-asset market making.

*Applied Mathematical Finance,**28*(2), 101–142.Bergault, P, & Guéant, O. (2021). Size matters for otc market makers: general results and dimensionality reduction techniques.

*Mathematical Finance,**31*(1), 279–322.Bergault, P., Bertucci, L., Bouba, D., Guéant, O., & Guilbert, J. (2023). Enhancing oracle-based automated market makers: advanced price and liquidity models.

*Working paper*.Bouba, D. (2021). Swaap.finance: Introducing the matrix-mm.

Boueri, N. (2021). G3M impermanent loss dynamics. arXiv preprint arXiv:2108.06593.

Breidenbach, L., Cachin, C., Chan, B., Coventry, A., Ellis, S., Juels, A., Koushanfar, F., Miller, A., Magauran, B., Moroz, D. et al. (2021). Chainlink 2.0: Next steps in the evolution of decentralized oracle networks.

*Chainlink Labs*.Capponi, A., & Jia, R. (2021). The adoption of blockchain-based decentralized exchanges. arXiv preprint arXiv:2103.08842.

Capponi, A., Iyengar, G., & Sethuraman, J. (2023). Decentralized finance: Protocols, risks, and governance.

*Foundations and Trends in Privacy and Security,**5*(3), 144–188.Cartea, Á., Donnelly, R., & Jaimungal, S. (2017). Algorithmic trading with model uncertainty.

*SIAM Journal on Financial Mathematics,**8*(1), 635–671.Cartea, Á., Drissi, F., & Monga, M. (2022). Decentralised finance and automated market making: Execution and speculation.

*Available at SSRN*.Cartea, Á., Drissi, F., & Monga, M. (2022). Decentralised finance and automated market making: predictable loss and optimal liquidity provision.

*Available at SSRN*.Cartea, Á., Jaimungal, S., & Penalva, J. (2015).

*Algorithmic and high-frequency trading*. Cambridge University Press.Cartea, Á., Jaimungal, S, & Ricci, J. (2014). Buy low, sell high: A high frequency trading perspective.

*SIAM Journal on Financial Mathematics,**5*(1), 415–444.Clark, J. (2020). The replicating portfolio of a constant product market.

*Available at SSRN 3550601*.Clark, J. (2021). The replicating portfolio of a constant product market with bounded liquidity.

*Available at SSRN*.Egorov, M. (2019). Stableswap—efficient mechanism for stablecoin liquidity.

Egorov, M. (2021). Automatic market-making with dynamic peg.

Evans, A. (2020). Liquidity provider returns in geometric mean markets. arXiv preprint arXiv:2006.08806.

Evans, A., Angeris, G., & Chitra, T. (2021). Optimal fees for geometric mean market makers. In

*International Conference on Financial Cryptography and Data Security*, pages 65–79. Springer.Fodra, P., & Pham, H. (2015). High frequency trading and asymptotics for small risk aversion in a markov renewal model.

*SIAM Journal on Financial Mathematics,**6*(1), 656–684.Fodra, P., & Pham, H. (2015). Semi-markov model for market microstructure.

*Applied Mathematical Finance,**22*(3), 261–295.Fritsch, R., Käser, S., & Wattenhofer, R. (2022). The economics of automated market makers. arXiv preprint arXiv:2206.04634.

Guéant, O. (2016).

*The Financial Mathematics of Market Liquidity: From optimal execution to market making*, volume 33. CRC Press.Guéant, O. (2017). Optimal market making.

*Applied Mathematical Finance,**24*(2), 112–154.Guéant, O., Lehalle, C.-A., & Fernandez-Tapia, J. (2013). Dealing with the inventory risk: a solution to the market making problem.

*Mathematics and Financial Economics,**7*(4), 477–507.Guéant, O., & Manziuk, I. (2019). Deep reinforcement learning for market making in corporate bonds: beating the curse of dimensionality.

*Applied Mathematical Finance,**26*(5), 387–452.Guilbaud, F., & Pham, H. (2013). Optimal high-frequency trading with limit and market orders.

*Quantitative Finance,**13*(1), 79–94.Guilbaud, F., & Pham, H. (2015). Optimal high-frequency trading in a pro rata microstructure with predictive information.

*Mathematical Finance,**25*(3), 545–575.Hasbrouck, J., Rivera, T.J., & Saleh, F. (2022). The need for fees at a dex: How increases in fees can increase dex trading volume.

*Available at SSRN*.Ho, T., & Stoll, H.R. (1981). Optimal dealer pricing under transactions and return uncertainty.

*Journal of Financial Economics*, 9(1):47–73.Ho, T. S. Y., & Stoll, H. R. (1983). The dynamics of dealer markets under competition.

*The Journal of Finance,**38*(4), 1053–1074.Lehalle, C.-A., & Laruelle, S. (2018).

*Market microstructure in practice*. World Scientific.Lehar, A., & Parlour, C.A. (2021). Decentralized exchanges. Technical report, Working paper.

Lipton, A., & Sepp, A. (2021). Automated Market-Making for Fiat Currencies. arXiv preprint arXiv:2109.12196.

Loesch, S., Hindman, N., Richardson, M.B., & Welch, N. (2021). Impermanent loss in uniswap v3. arXiv preprint arXiv:2111.09192.

Mackinga, T., Nadahalli, T., & Wattenhofer, R. (2022). Twap oracle attacks: Easier done than said?

*Cryptology ePrint Archive*.Martinelli, F., & Mushegian, N. (2019). A non-custodial portfolio manager, liquidity provider, and price sensor.

Milionis, J., Moallemi, C., Roughgarden, T., & Zhang, A.L. (2023) Automated market making and loss-versus-rebalancing.

Milionis, J., Moallemi, C., Roughgarden, T. (2023). Automated Market Making and Arbitrage Profits in the Presence of Fees. arXiv preprint arXiv:2305.14604.

Mohan, V. (2022). Automated market makers and decentralized exchanges: a DeFi primer.

*Financial Innovation,**8*(1), 1–48.Neuder, M., Rao, R., Moroz, D.J., & Parkes, D.C. (2021). Strategic liquidity provision in uniswap v3. arXiv preprint arXiv:2106.12033.

O’hara, M., & Oldfield, G.S. (1986). The microeconomics of market making.

*Journal of Financial and Quantitative analysis*, 361–376.Schrimpf, A., & Sushko, V. (2019). FX trade execution: complex and highly fragmented.

*BIS Quarterly Review, December*.Schrimpf, A., & Sushko, V. (2019). Sizing up global foreign exchange markets.

*BIS Quarterly Review, December*.Stoll, H.R. (2003). Market microstructure. In

*Handbook of the Economics of Finance*, volume 1, 553–604.Tjiam, K., Wang, R., Chen, H., & Liang, K. (2021). Your smart contracts are not secure: Investigating arbitrageurs and oracle manipulators in ethereum. In

*CYSARM@ CCS*, 25–35.

## Acknowledgements

The research carried out for this paper benefited from the support of the Research Program “Decentralized Finance and Automated Market Makers”, a Research Program under the aegis of Institut Europlace de Finance, in partnership with Apesu / Swaap Labs.

The content of this article has been presented at several conferences and seminars: BlockSem seminar (Paris, France), FFEA 2nd Spring Workshop on FinTech (Ghent, Belgium), The 3rd workshop on Decentralized Finance (Bol, Croatia), DeFOx seminar (Oxford, UK), Euro Working Group on Commodities and Financial Modelling meeting (Rome, Italy), SIAM Conference on Financial Mathematics and Engineering (Philadelphia, USA), AMaMeF conference (Bielefeld, Germany), Florence-Paris Workshop on Mathematical Finance (Florence, Italy), Frontiers in Quantitative Finance Seminar (London, UK), Séminaire Bachelier (Paris, France), 16th Financial Risks International Forum (Paris, France), London-Paris Bachelier Workshop on Mathematical Finance (London, UK), Blockchain@X-OMI Workshop on Blockchain and Decentralized Finance (Palaiseau, France), Apéro DeFi (Paris, France). The discussions that took place during these events have substantially contributed to improving the presentation of our results.

We extend our sincere gratitude to the two anonymous referees for their insights and constructive feedback, which greatly enhanced the quality of our article.

## Author information

### Authors and Affiliations

### Corresponding author

## Additional information

### Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

## About this article

### Cite this article

Bergault, P., Bertucci, L., Bouba, D. *et al.* Automated market makers: mean-variance analysis of LPs payoffs and design of pricing functions.
*Digit Finance* **6**, 225–247 (2024). https://doi.org/10.1007/s42521-023-00101-0

Received:

Accepted:

Published:

Issue Date:

DOI: https://doi.org/10.1007/s42521-023-00101-0