## Abstract

We present a method for constructing constant function market makers (CFMMs) whose portfolio value functions match a desired payoff. More specifically, we show that the space of concave, nonnegative, nondecreasing, 1-homogeneous payoff functions and the space of convex CFMMs are equivalent; in other words, every CFMM has a concave, nonnegative, nondecreasing, 1-homogeneous payoff function, and every payoff function with these properties has a corresponding convex CFMM. We demonstrate a simple method for recovering a CFMM trading function that produces this desired payoff. This method uses only basic tools from convex analysis and is intimately related to Fenchel conjugacy. We demonstrate our result by constructing trading functions corresponding to basic payoffs, as well as standard financial derivatives, such as options and swaps.

### Similar content being viewed by others

## Data availability

No data was used in this paper.

## References

Angeris, G., Agrawal, A., Evans, A., Chitra, T., & Boyd, S. (2022).

*Constant function market makers: Multi-asset trades via convex optimization*(pp. 415–444). Springer International Publishing. https://doi.org/10.1007/978-3-031-07535-3_13Angeris, G., & Chitra, T. (2020). Improved price oracles: Constant function market makers. In

*AFT ’20*(pp. 80–91). Association for Computing Machinery. https://doi.org/10.1145/3419614.3423251.Angeris, G., Chitra, T., & Evans, A. (2022). When does the tail wag the dog? Curvature and market making.

*Cryptoeconomic Systems, 2*(1). https://doi.org/10.21428/58320208.e9e6b7ce.Angeris, G., Kao, H.-T., Chiang, R., Noyes, C., & Chitra, T. (2021). An analysis of Uniswap markets.

*Cryptoeconomic Systems, 0*(1). https://doi.org/10.21428/58320208.c9738e64.Boyd, S. P., & Vandenberghe, L. (2004).

*Convex optimization*. Cambridge University Press.Carr, P. P., & Jarrow, R. A. (1990). The stop-loss start-gain paradox and option valuation: A new decomposition into intrinsic and time value.

*The Review of Financial Studies,**3*(3), 469–492. http://www.jstor.org/stable/2962078.Clark, J. (2020). The replicating portfolio of a constant product market. Available at SSRN 3550601.

Daian, P., Goldfeder, S., Kell, T., Li, Y., Zhao, X., Bentov, I., et al. (2020). Flash boys 2.0: Frontrunning in decentralized exchanges, miner extractable value, and consensus instability. In

*2020 IEEE Symposium on Security and Privacy (SP)*(pp. 910–927). IEEE.Evans, A. (2021). Liquidity provider returns in geometric mean markets.

*Cryptoeconomic Systems, 1*(2). https://doi.org/10.21428/58320208.56ddae1b.Evans, A., Angeris, G., & Chitra, T. (2021). Optimal fees for geometric mean market makers.

*Financial Cryptography and Data Security. FC 2021 International Workshops. FC 2021*. Lecture Notes in Computer Science (vol. 12676). Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-63958-0_6.Foucault, T., Moinas, S., & Theissen, E. (2007). Does anonymity matter in electronic limit order markets?

*The Review of Financial Studies,**20*(5), 1707–1747.Gregoriou, G. N. (2016).

*The handbook of trading: Strategies for navigating and profiting from currency, bond, and stock markets*. The McGraw-Hill Companies.Kao, H. T., Chitra, T., Chiang, R., & Morrow, J. (2020). An analysis of the market risk to participants in the compound protocol. In

*Third international symposium on foundations and applications of blockchains*.Martinelli, F., & Mushegian, N. (2019). Balancer: A non-custodial portfolio manager, liquidity provider, and price sensor.

Moallemi, C., & Yuan, K. (2014). The value of queue position in a limit order book.

*Market Microstructure: Confronting Many Viewpoints*.Neuberger, A. (1994). The log contract.

*The Journal of Portfolio Management,**20*(2), 74–80. https://doi.org/10.3905/jpm.1994.409478. https://jpm.pm-research.com/content/20/2/74.Rockafellar, R. T. (1970).

*Convex analysis*(Vol. 28). Princeton University Press.Shreve, S. E. (2004).

*Stochastic calculus for finance II: Continuous-time models*. Springer. https://books.google.com/books?id=O8kD1NwQBsQC.Sterrett, E., Jepsen, W., & Kim, E. (2022). Replicating portfolios: constructing permissionless derivatives. arXiv preprint arXiv:2205.09890.

Zhang, Y., Chen, X., & Park, D. (2018). Formal specification of constant product (\(xy=k\)) market maker model and implementation.

## Acknowledgements

The authors would like to thank Neelesh Tiruviluamala for useful discussions and finding some inconsistent notation in an earlier draft. The authors would also like to thank the anonymous reviewers for their feedback and suggestions, most of which were incorporated in the text.

## 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.

## Appendix: Delta-hedging

### Appendix: Delta-hedging

As in Sect. 4, we have that \(c_1 \in {{\textbf {R}}}_+\), \(R_1 \in {{\textbf {R}}}_+\), and \(R_2 \in {{\textbf {R}}}_+\) are all scalar quantities, where \(c_1\) is the price of the asset in question. We seek to construct a trading function such that \(R_1=R_1(c_1)\) for all \(c_1\). We define

which is the marginal price of the traded coin. Recalling that \(R_2\) can be thought of as an implicit function of \(R_1\), we have

Therefore

will give a family of trading functions with the desired property.

*Hedging a covered call* Extending the example in Sect. 4, we now look at delta-hedging a covered call. In this case, we hold \(\frac{\text{d}}{\text{d}c} V(c)\) units of the risky asset, i.e., \(R_1(c)=1-\Phi (d_1)\). We therefore have

where *h* is defined as before where *h* is defined as \(h(R) = \text{e}^{\sigma \sqrt{\tau }\Phi ^{-1}(1-R_1)-\tau \sigma ^2}\). In this case, we have the trading function

where *k* is an arbitrary constant. As before, *k* will control where the hedge will fail as the CFMM runs out of reserves. An appropriate choice would be to select *k*, such that the initial value of reserves match the initial price of the covered call. In this case, we have

Substituting the values for \(R_1(c)=1-\Phi (d_1)\) and \(R_2=k-\frac{1}{2}K+K\Phi (\Phi ^{-1}(1-R_1)-\sigma \sqrt{\tau })\) and solving for *k*, one obtains \(k=\frac{K}{2}\). Substituting this value recovers the trading function derived in Sect. 4.

*Hedging a log contract* We consider the case of delta-hedging a short position in a log contract. As noted in Neuberger (1994), delta-hedging a contract paying the natural logarithm of the futures price will replicate a variance swap. In this case, we seek a trading function for which \(R_1(c)=\frac{1}{c_1}\). In other words, to achieve the desired hedge, we seek a CFMM that holds one unit of asset 2’s worth in asset 1. Noting that

we get

where *k* is an arbitrary constant. Any trading function of the form

will achieve the desired hedge insofar as \(k \ge \ln {R_1}\) or \(c_1 \ge \text{e}^{-k}\), as the CFMM will otherwise run out of the reserves required to continue hedging (Fig. 3).

*Path dependence and arbitrage loss* Suppose the price of the asset at time *t* is \(c_1(t)\) and consider delta-hedging a short position in the log contract by holding \(\frac{1}{c_1(t)}\) units of the asset under zero transaction costs. The profit-and-loss (PNL) of this strategy over a discrete period \([t,t+1]\) is \(\frac{1}{c_1(t)}(c_1(t+1)-c_1(t))\). When continuously rebalancing over [0, *T*], we have PNL \(\int _0^{\textrm{T}} \frac{1}{c_1(t)} \text{d}c_1(s)\). For simplicity of illustration, suppose \(c_1(t)\) follows a geometric Brownian motion with stochastic differential

where *W*(*t*) is a standard Brownian motion. One can check that the expected PNL of the delta-hedging strategy is zero. Now, we contrast this with delta-hedging with the CFMM we recovered in (A1). One can check that this CFMM has payoff

The expected PNL of this strategy is therefore

In other words, implementing the delta-hedge through a no-fee CFMM instead of continual rebalancing under no transaction costs will result in a supermartingale. This observation is analogous to the result in Angeris and Chitra (2020) and Evans et al. (2020) that the portfolio value of a G3M or constant-mean market maker is a supermartingale under the risk-neutral measure due to arbitrage losses.

More generally, a no-fee CFMM has payoff \(V(c)=R_1c + R_2\), which is always path-independent. In contrast, the equivalent delta-hedging strategies continually rebalanced at no cost are path-dependent. When delta-hedging a convex strategy, one’s portfolio will be short gamma and long theta (Shreve, 2004). The equivalent CFMM does not benefit from positive theta due to arbitrage, resulting in the supermartingale behavior. In other words, delta hedging a convex claim with a CFMM with the appropriate concave payoff will underperform the equivalent delta-hedge rebalanced under no transaction costs. We conjecture that a result similar to that of Evans et al. (2021) may allow one to arbitrarily approximate unconstrained delta-hedging strategies with CFMMs by taking the directional limit as the fee approaches zero, but do not pursue this direction further in this paper.

## 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

Angeris, G., Evans, A. & Chitra, T. Replicating market makers.
*Digit Finance* **5**, 367–387 (2023). https://doi.org/10.1007/s42521-023-00082-0

Received:

Accepted:

Published:

Issue Date:

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