2School of Mathematics, University of Edinburgh
3Simtopia.ai
4Vega Protocol
Inefficiency of CFMs: hedging perspective and agent-based simulations
Abstract
We investigate whether the fee income from trades on the CFM is sufficient for the liquidity providers to hedge away the exposure to market risk. We first analyse this problem through the lens of continuous-time financial mathematics and derive an upper bound for not-arbitrage fee income that would make CFM efficient and liquidity provision fair. We then evaluate our findings by performing multi-agent simulations by varying CFM fees, market volatility, and rate of arrival of liquidity takers. We observe that, on average, fee income generated from liquidity provision is insufficient to compensate for market risk.
1 Introduction
It has been shown empirically [7] and experimentally [19] that liquidity providers (LPs) in constant function markets (CFMs) (in particular, Uniswap v3) lose money on average. Indeed, from e.g. [7, Table 2], the average LP transaction in the ETH/USDC pool (from May 2021–-August 2022) resulted in a position loss of , and fee income of of the size of the initial trade, with an average hold time of 6.1 days.
An LP entering a position in CFM opens themselves to two risks: the impermanent loss due to price moves in the underlying asset and the risk of fee income not compensating the impermanent loss. A rational LP may choose to hedge the impermanent loss component, which is essentially a perpetual option [2]. If the fee income (from trades on the CFM) exceeds the cost of the hedge the LP is making a risk-free profit. However, if the fee income is below the cost of the hedge the LP is making a loss. We formalise this intuition using tools from continuous-time financial mathematics, to derive a theoretical, arbitrage-free upper bound on the fee income that would make the CFM efficient and LP positions fair. This is our Theorem 2.1. This is complementary perspective to that of loss versus rebalancing (LVR) introduced in [17].
The fee income of the LP depends on the CFM fee (denoted in Uniswap) and the trade flow. There is no canonical way to jointly model the underlying price process and the trade flow which realistically captures the interdependence of the two. For this reason we analyse the relationship between the LP fee income and the arbitrage-free upper bound using simulations involving a CFM, another liquid exchange, an arbitrageur agent and price sensitive noise traders (they choose between the exchanges based on which offers better execution price). We considered the CFM fee to be in the range to and in this range the simulations show that fee income due to the LP never exceeds the cost of hedging i.e. the LP is always losing money. As one would expect from Theorem 2.1 the loss is higher if the volatility of the underlying asset is higher. This is regardless of the rate of noise traders arriving in the market. One may hope that the solution is to increase the fee the CFM charges but this reduces the trade flow thus reducing the income. Similarly, reducing the slippage by depositing more into the pool would increase trade but would not lead to lower losses for LPs as this increases the hedging cost of the LP position.


1.1 Literature review
The CFM are gaining popularity in market design as they guarantee market liquidity (proportional to the amount of assets locked) and they have minimal storage and computational requirements, unlike e.g. limit-order-book-based markets. This makes them ideal for environments where computational power and storage are at a premium like Ethereum [20], or Cardano, Polkadot or Solana.
Running on blockchain gives advantages over centralised exchanges: transparency, pseudonymity, censorship resistance and security, see references in e.g. [16]. However blockchain-based CFMs suffer from a number of problems: namely questionable returns for LPs as has been already mentioned as well as traders (liquidity takers) being front-run by miners (known as miner-extractable-value) [8], [10].
Classical market clearing models suggest, see Glosten & Milgrom [11], Kyle [13, 14] and Grossman & Miller [12], that the volatility of the underlying asset plays an important role in how the market makers should set bid-ask spread (which is comparable to the pool fee as it imacts execution costs). As we show in Theorem 2.1 the fee income due to the CFM LPs is bounded above by a product of quadratic variation of the underlying asset (which is basically volatility) and convexity of the position being hedged.
1.2 Organisation of the paper
Section 2 includes all the theoretical findings of the paper. Some readers may wish to skim through Section 2.1 which reviews CFMs and how liquidity provision works and fixes some notation used further in the paper. Section 2.2 recalls what a perpetual option is, Section 2.3 proves the main theoretical result of the paper which is Theorem 2.1. Section 3 describes in detail the agent-based model used and discusses the findings. Finally, in Section 4, we discuss the main findings, their limitations and possible further work. A full implementation of the agent-based simulation is at111The link is deliberately broken to comply with the anonymous submission format. https://github.com/simtopia/cfm-sim.
2 Liquidity provision in constant function markets
In this section, we will draw a connection between a constant function market (CFM) and a perpetual (American) options contract. We will particularly seek to derive the impermanent loss (also known as LVR) of a CFM, or equivalently the arbitrage-free streaming premium of the perpetual option.
2.1 An overview of CFMs
A constant function market (CFM) is characterised by
-
i)
The reserves describing amounts of assets in the pool.
-
ii)
A trading function which determines the state of the pool after each trade according to the acceptable fund positions:
(1) -
iii)
A trading fee , for .
For the purposes of this paper, we assume to be twice continuously differentiable and convex (see [6], [5]).
To acquire of asset at time a trader needs to deposit a quantity of asset into the pool, and pay a fee .222The fee in Uniswap-V3 is not added to the pool reserves [1]. This is in contrast to Uniswap-V2. and needs to satisfy the equation
(2) |
Once the trade is accepted the reserves are updated according to
(3) |
The relative price of trading for is defined as
(4) |
Observe that
(5) |
Hence the relative price of trading an infinitesimal amount of for is given by
(6) |
Assume that there is an external market where assets and can be traded (without frictions) at the prices . The no-arbitrage condition in the case of no fees ( implies that
(7) |
Conversely, if 7 would not hold, then (in a market with no fees) there would be an arbitrage opportunity between CFM and the external market (assuming frictionless trading is possible), as it would be possible to purchase a combination of assets cheaply in one market, and then sell it in the other.
Example 1 (GMM)
The above example, also studied in [9], demonstrates two key properties of CFMs:
-
•
A GMM automatically re-balances liquidity pools so that the value of the pools with asset and is and , respectively
-
•
Providing liquidity to a CFM is equivalent to entering a long position on a perpetual derivative on the underlying asset with the payoff dictated by the value (in terms of price) .
As observed in [3], [4], for any CFM for any non-negative, non-decreasing, concave, 1-homogenous333That is, for all and . Equivalently, we can assume that one of the assets in is the numeraire asset, in which case the 1-homogeneity assumption is not needed. payoff function , there exists a trading function , such that the value of the liquidity provision in CFM with with function matches this payoff function. In other words, a CFM with appropriately designed trading function dynamically adjusts portfolio held by liquidity providers so that the value of this portfolio, at any time, is described by the payoff function . This gives us two ways to understand a CFM:
-
•
Through the defining trading function , indicating valid combinations of the two assets.
-
•
Through the valuation function , indicating the value of the CFM pool in terms of the prices of the two assets.
Concentrated liquidity, introduced in Uniswap V3, gives individual LPs control over what price ranges their capital is allocated to. This gives a practical way of creating liquidity provision that replicates a given function , and has been observed and described in [15].
2.2 Connection with perpetual options
Given a payoff function , there is a simple connection between liquidity provision in a CFM and investment in a perpetual American option.
We begin with a precise definition of a perpetual American contract with streaming premium. As we shall see, liquidity provision in a CFM is equivalent to entering a long perpetual derivative with the payoff dictated by the function . This derivative is written on the underlying assets traded in the pools. We follow the definition from [2].
Definition 1
A perpetual contract with streaming premium, written on assets with price vector , with payoff function , is a agreement between two parties, referred to as the long side and short side. The long side has the right to terminate the contract at any time , at which point it will receive a payment of . In return, the long-side must pay to the short side at the time of inception as well as a continuous cash-flow of per unit time, referred to as the streaming premium, up until the contract is terminated.
In order to highlight the connections between a CFM and a perpetual American option, we make the following observations. In a CFM, a liquidity provider (CFM-LP)
-
•
initially deposits assets with value ,
-
•
receives fees at the rate per unit time (which may vary). These fees may be withdrawn (under the Uniswap v3 protocol) at any time,
-
•
at some future time (of the CFM-LPs choosing), may withdraw their assets, which will have value .
In a perpetual American option with streaming premium and payoff , an investor purchasing the option
-
•
initially purchases the option, for a cost ,
-
•
receives the streaming premium at a rate per unit time (which may vary). This streaming premium may be positive or negative, and is received immediately,
-
•
at some future time (of the investor’s choosing), may exercise the option, which rewards them with value .
As we can see, assuming fees in the CFM are instantaneously predictable (i.e. the fee to be received from the CFM can be accurately estimated in advance), a no arbitrage argument suggests that we must have , as otherwise one asset is strictly better than the other in every state of the world (over some short time horizon), which implies that an efficient market will focus all its trading in the better of these alternatives.
2.3 Model and assumptions
We make the following assumptions about the market:
-
•
The agent can borrow and lend any amount of cash at the riskless rate.
-
•
The agent can buy and sell any amount of assets and .
-
•
The above transactions do not incur any transaction costs and the size of a trade does not impact the prices of the traded assets.
We denote the risk free rate (which may be stochastic) by and model the money market as
(13) |
We assume . We further denote the drift and diffusion coefficients (again, possibly stochastic) of the risky asset shadow prices by and
respectively, and model the shadow price of the risky asset by
(14) |
where is a -dimensional Brownian motion. We assume that are sufficiently regular that a (unique strong) solution to (14) exists.
Remark 1
By allowing the drift and diffusion coefficients to be arbitrary processes we are just saying that the prices are non-negative and continuous: our framework incorporates a rich family of common models such as Black–Scholes, Heston, SABR or local stochastic volatility models with possibly path dependent coefficients.
We will proceed to derive an arbitrage-free fee bound in a similar way to the construction of the predictable loss in [17], and to classical arguments for no-arbitrage pricing in financial markets.
Assumption 1
The value of the pool as a function of external price process, is twice continuously differentiable.
Assumption 1 holds in the case when the fee and arbitrageurs continuously close the gap between and the price of the CFM, as demonstrated in [17]. Hence we expect the the arbitrage-free fee derived below to be a good proxy for CFMs that charge small fee (e.g Uniswap). If the CFM charges a fee which is significantly larger than then the value of the pool is a function of the reserves and the price one would use for the conversion (external price or pool-implied price ), see Remark 2 for more details.
Consider the wealth process of an agent who
-
•
begins with zero capital444This is simply to avoid having to account for the interest they should earn on their initial capital.,
-
•
initially borrows a quantity at the risk-free interest rate, which they use to establish a CFM position (which they can do by trading in the liquid market to obtain the desired risky assets for the pool),
-
•
until time , trades in the liquid market hold a quantity of each asset at time .
The dynamics of are given by
We assumed is smooth, hence we can apply Itô’s lemma to obtain
By setting , we eliminate the first term, giving
As the quadratic variation is , this simplifies to
If this quantity is positive, then we have a strategy which earns money with probability one over a short time period, that is, an arbitrage. Therefore, after rearrangement, we know that
As is increasing in (an agent who earns more fees will be wealthier) and we assume , there is a unique value of such that above equation is an equality. With this CFM trading fee income per unit of time, we have and , and hence . We denote this critical value555[7] give a similar calculation, to obtain a closely related quantity, which they call the permanent loss of the CFM.
We have thus shown the following.
Theorem 2.1
Notice that the critical CFM fee income rate depends on the trading function via (which is negative, as is concave as long as the trading function is convex) and the quadratic variation of traded asset (which is implicitly related to the level of trading activity). On the other hand the actual CFM fee income rate depends on the trade flow in the CFM and the fee the pool sets i.e. . It is not clear that one could bring in line with as increasing , the fee charged by the CFM will likely lead to decreased trade flow.
Note that this argument only uses a long-position in the CFM, and only establishes666The presentation above assumes the agent starts at time , and derives the critical fee rate on this basis. To obtain the inequality bound for all times, we formally have to consider starting with zero capital at a time where the inequality is not satisfied, and showing that this gives a short-term arbitrage opportunity. the inequality . If it were possible to perfectly short-sell the CFM (or the corresponding perpetual option), then a similar argument would yield the converse inequality. This may explain why the fee rate in Uniswap v3, is systematically below the critical fee rate, which is related to liquidity provision in CFMs yielding persistently poor returns.
Example 2
For clarity of presentation we set the risk free interest rate , and assume that asset is a numeraire (hence the agent only invests in asset ). This means that
(16) |
The second derivative of is given by , which is negative since . The critical fee rate is then given by
(17) |
As mentioned above, by analyzing the data in the Uniswap v3 pool (e.g. [7]) one can see that, in general, the fee rate is below critical fee rate. Nevertheless, since one cannot simply short position at the Uniswap (unless using an over-the-counter bespoke arrangement) it is not clear how one could realise a potential arbitrage opportunity when .
Remark 2 (Comments about the derivation of the arbitrage-free fee rate bound)
The derivation of the arbitrage-free fee rate bound is done under the Assumption 1 which, as we explained, holds in the case when .
If for each trade the CFM charges a fee it can be easily shown that this optimal arbitrage trades will not lead to condition (7). We demonstrate this on Figure 2. Indeed the arbitrageur who trades when reserves are will incur cost and solves the optimisation problem , where
(18) |
and
(19) |
where the subindexes of denote the order of the markets where the arbitrageur goes short and long in asset . If , then there is no possible trade for which an arbitrageur makes a profit. When condition (7) does not hold, the model to calculate the arbitrage fee rate bound needs to be generalized. A first step in this direction is to re-rewrite the value function as a function of . Furthermore, using Implicit Function Theorem for trading function , there is function such that . Hence, assuming is the numeraire so that ,
Applying Itô formula to we get
One can see that to analyse the evolution of the value of the pool one needs to model the evolution of reserves and its dependence on . Instead of performing analysis under various sets of assumptions we turn to simulations.
3 An Agent-based model
We design an Agent-Based-Model with the aim to compare the accumulated fees by a CFM defined as in Example 1 with in a period of time against the accumulated non-arbitrage fee derived in Section 2.3.
3.1 Model description
We consider the CFM with being the numeraire. Price discovery occurs in a second reference market, where denotes the price of asset in terms of the numeraire at time . We model the price by a Geometric Brownian Motion
Whenever the price of asset in terms of the numeraire in the CFM is different than , there might be an arbitrage opportunity. An arbitrageur will automatically make the necessary trades to maximise their profit. Furthermore we model the arrival of liquidity takers by Poisson process with intensity . We run the simulation of discrete times and initialise the simulation with reserves and fee ; initial price and volatility ; liquidity takers arrival intensity . We run the following simulation.
For every :
- •
-
•
If then a price-sensitive liquidity trader arrives and trades sampled from of asset . The noise trader chooses the market with better execution price with some high probability , i.e. we allow for the noise trader to be irrational with probability 777Perfectly rational liquidity trader would consider splitting the order to optimise the execution cost. We omit this extension in our simulations..
We take and fix and run the above simulation 100 times for different values of .
3.2 High fee and low fee
Figures 2, 3, 4 and 5 consider two simulated scenarios: high fee value ( i.e fee ); low fee value of ( i.e fee ), and . Figures 2 and 4 provide the evolution of the price process for the two simulated scenarios in the CFM for the same price process in the reference market. The smaller the fee (the higher the value of ) the closer the CFM price process depicted in blue follows the reference market price . For these two scenarios, the CFM and arbitrage-free fee rates are shown in Figures 3 and 5, and the area under the fee rates corresponds to accumulated fees in that particular simulation. High values of fees (low values of ) indicate less arbitrage opportunities, and therefore the number of trades will be lower than in the low fees scenarios. Hence increasing the fee rate does not necessarily lead to higher fee income. However, in higher fees regimes, the trade sizes will necessarily be higher (there will only be an arbitrage opportunity when the gap between the CFM price and the reference price is big enough to compensate for the fee).
Fixing , Figure 1 aggregates the generated results for all the considered . Figure 1(a) indicates that higher trades will bring higher fees on average, yet they will not be able to cover the cost of hedging the impermanent loss, which increases with the volatility .




3.3 Impact of noise trader arrival rate
Figure 6 aggregates all the simulations for three considered intensity regimes for the noise trader. Again, in average the CFM fee does not cover the cost of hedging impermanent loss and, furthermore, this is not impacted by the arrival intensity of noise traders.

4 Conclusion and future work
In Theorem 2.1 we have derived an upper bound on the fee income for an LP placing liquidity in a CFM which does not lead to arbitrage when compared to the cost of hedging the risk of the underlying price moves (referred to as impermanent loss). These findings are augmented by agent based simulations which indicate that at least in some market regimes LP providers in CFMs are not being adequately compensated for the impermanent loss risk they take on.
The theoretical model used to derive Theorem 2.1 makes a number of simplifying assumptions that are common in financial mathematics but on top of that it only applies in the low fee regime of CFMs, as discussed in Remark 2. To better study the higher fee regimes one would need to jointly model the trade flow and its impact on the underlying price or to model the joint evolution of the reserves and the underlying asset price. This, mathematically more challenging problem, is left for future work.
The agent-based simulation could be exctended in a number of ways. More realistic agent order flow could be based directly on empirical data e.g. from [18]. The liquidity takers could not only choose the venue which provides better execution price but could split their orders for lowest overall execution cost. Furthermore, most arbitrageurs do not to realise the arbitrage in one “step”; instead they should consider multi-step optimisation with penalty for inventory leading to dynamic-programming problems (or, if we assume that the model of underlying price is unknown, to a reinforcement learning problem). Again, this more involved investigation is left for future work.
Appendix 0.A Derivation of for the Geometric Mean Market
Consider the trading function
(20) |
for . In the setting with no fees, , we have . The no arbitrage relationship (7), in GMM is given by
(21) |
The value of the liquidity pool at any time , is given by
(22) |
Note that, under no arbitrage and no fee assumptions, it makes no difference whether the accounting is being done in or .
Using (21) we can show that
(23) |
or equivalently
(24) |
From here we see that the value of the sub-pools with assets and are and , respectively.
Next, we derive an alternative representation for that does not depend on . To do that, note that
(25) |
Hence
(26) |
Since
(27) |
we have
(28) |
References
- [1] H. Adams, N. Zinsmeister, M. Salem, R. Keefer, and D. Robinson. Uniswap v3 core. Tech. rep., Uniswap, Tech. Rep., 2021.
- [2] G. Angeris, T. Chitra, A. Evans, and M. Lorig. A primer on perpetuals. arXiv preprint arXiv:2209.03307, 2022.
- [3] G. Angeris, A. Evans, and T. Chitra. Replicating market makers. arXiv preprint arXiv:2103.14769, 2021.
- [4] G. Angeris, A. Evans, and T. Chitra. Replicating monotonic payoffs without oracles. arXiv preprint arXiv:2111.13740, 2021.
- [5] G. Angeris, H.-T. Kao, R. Chiang, C. Noyes, and T. Chitra. An analysis of uniswap markets. arXiv preprint arXiv:1911.03380, 2019.
- [6] A. Capponi and R. Jia. The adoption of blockchain-based decentralized exchanges. arXiv preprint arXiv:2103.08842, 2021.
- [7] A. Cartea, F. Drissi, and M. Monga. Decentralised finance and automated market making: Permanent loss and optimal liquidity provision. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4273989, 2022.
- [8] P. Daian, S. Goldfeder, T. Kell, Y. Li, X. Zhao, I. Bentov, L. Breidenbach, and A. Juels. Flash boys 2.0: Frontrunning, transaction reordering, and consensus instability in decentralized exchanges. arXiv:1904.05234, 2019.
- [9] A. Evans. Liquidity provider returns in geometric mean markets. 2021.
- [10] Flashbots. Mev-explore v0. https://explore.flashbots.net.
- [11] L. R. Glosten and P. R. Milgrom. Bid, ask and transaction prices in a specialist market with heterogeneously informed traders. Journal of Financial Economics, 14:71–100, 1985.
- [12] S. J. Grossman and M. H. Miller. Liquidity and market structure. The Journal of Finance, 43:617–633, 1988.
- [13] A. S. Kyle. Continuous auctions and insider trading. Econometrica, 53:1315–1335, 1985.
- [14] A. S. Kyle. Informed speculation with imperfect competition. The Review of Economic Studies, 56:317–455, 1989.
- [15] G. Lambert and J. Kristensen. Panoptic: a perpetual, oracle-free options protocol. arXiv preprint arXiv:2204.14232, 2022.
- [16] S. Loesch, N. Hindman, M. B. Richardson, and N. Welch. Impermanent loss in uniswap v3. arXiv:2111.09192, 2021.
- [17] J. Milionis, C. C. Moallemi, T. Roughgarden, and A. L. Zhang. Automated market making and loss-versus-rebalancing. arXiv preprint arXiv:2208.06046, 2022.
- [18] D. Miori and M. Cucuringu. Defi: Data-driven characterisation of Uniswap v3 ecosystem & an ideal crypto law for liquidity pools. arXiv:2301.13009, 2022.
- [19] M. Sabate-Vidales and D. Šiška. The case for variable fees in constant product markets: An agent based simulation. In Financial Cryptography and Data Security, 2022.
- [20] G. Wood. Ethereum: A secure, decentralised generalised transaction ledger. Ethereum project yellow paper, 2014.