# How Automated Market Makers Work (AMMs)

Automated Market Makers are a relatively new invention. They were formulated in 2017 and launched on Ethereum shortly after. However, it wasn't until 2020 that they started to gain popularity and have become mainstream in crypto and grown to include all kinds of assets, from Tokens to Synthetic stocks to Options.

AMMs have a chance to revolutionize what it means to be an"exchange" and what it means to be a professional Market Maker. They give an average retail trader the tools to participate in the lucrative business of brokers, banks, and clearinghouses. And for that, all the user needs is some cryptocurrencies in his web wallet.

The article will cover how the AMMs work, their risk, and what to expect when trading or proving liquidity. We use straightforward language to get the message across as clearly as possible. We will err on the side of clarity over form, which at times might seem repetitive, but this is intentional. After more than two decades in the financial industry, I have found more praise for clarity than for form.

## Introduction

In the traditional financial setting, you have two routes when you want to buy or sell some assets. You can go to a broker/dealer and ask for a price or go to an exchange and look up what prices are offered by professional market markers. And after you find a reasonable price, you will need to exchange details, wire the money, and receive your product.  There is a lot of admin work involved.

With an AMM, the result for a trader is the same; the difference is how you get to this result. Often quicker, cheaper, and more reliably, thanks to the rise of automation and digitization of our economy, brought new, more affordable, and more reliable trading methods.

The new technology of blockchain brings a lot of advantages. Dealing with AMMs means making all the decisions up front and meeting all admin conditions before executing a trade. Then, after completing a trade, you receive the asset instantaneously, and there is no more admin; the asset arrives in your account by itself. Also, because AMMs live on a blockchain, all the transaction records are saved forever; you can always go back later and check what you.

However, because the technology is new, there is still a lot of misunderstanding about how AMMs work, their benefits, how they make money, and most importantly, the risks involved. Yes, the risks.

This the single biggest reasons why investors give-up and leave too soon, or even worse, move their capital into more speculative AMMs is because they don't understand what the are risks involved when providing liquidity to an AMM in the first place. The main illusion is chasing after high yields that can sometimes be >100% annualized without giving thought what is causing the yield to be this high.

## Who uses an AMMs?

The primary users of AMMs are traders wanting to swap a token for another token. And then, there are liquidity providers who provide the liquidity to an AMM. Liquidity providers do not need to be large institutions with a lot of capital; they can be the average Jo who has some money and wants to put it to work. There is no minimum amount that can be traded or provided liquidity.

The traders certainly transact more frequently with an AMM. While liquidity providers generally add liquidity to the pool and forget about it for a few days or a week. In that regard, the traders are much more active than the liquidity providers.

To explain who uses the AMMs so that everyone can understand, we start with an analogy of a farmer's market. It doesn't matter what analogy one uses to describe a market, as markets are all the same, and the only difference between them is the assets exchanged there.

### An analogy to a Farmers' Market

At a farmers' market, a farmer operates a stall where he shows his inventory and waits for buyers to come by. His job is to sit there, advertise his goods and wait for buyers to come to him. His job is passive in that regard; he needs to sit and wait rather than actively do anything (perhaps raise his voice once in a while to attract attention). He makes a market in the product that he has on his stall and acquired with his labor or by investing his capital. To make it interesting for him, he expects to sell it for a higher price than what he bought it for, so he can make a profit.

Then some clients come to the market looking for things to buy. They come up to stalls, look at what is for sale and check the prices. If they like what they see and the price suits them, they will swap their cash for some of that produce. In doing so, the client initiates a transaction with the stole owner (the market maker). At the end of the transaction, the client exchanged cash for the produce, and the stall owner is left with more cash and less product to sell.

Markets are a very efficient mechanism for exchanging goods and services in a free market society. The classical economist Adam Smith first described this efficient mechanism in his "invisible hand" metaphor - " ... firms, in the pursuit of profits, are led, as if by an invisible hand, to do what is best for the world ..." and it still stands to this day. Individuals and organizations create a market because it is beneficial for them.

The market also derives a price for goods that balances the demand and supply; it creates a fair price that clients and market makers are willing to trade. So, for example, if the stall owner finds that clients are buying his lemons too quickly, he will raise the price so that his inventory lasts him until the end of the day and make him some extra cash at a higher price. At the same time, the clients might not appreciate the higher price for the last lemons, but they will know that they will still be able to get some.

Besides clients and stall owners, there are also arbitrageurs in the market. Arbitrageurs are good people in the marketplace; they keep the price balanced by observing discrepancies between markets and taking action to re-balance them. They are very well-informed and sophisticated clients who can act quickly.

In the above example, if the stall owner is left with too few lemons and raises the price, he would appreciate it if someone came to him and replenished his inventory to continue selling to other clients. In this situation, an arbitrageur could run to the closes farmers' market, buy some lemons there at a lower price and bring them back to the local market and sell them in bulk to the stall owner. The arbitrageur would profit, the stall owner would have more inventory, and all other clients could now buy the merchandise at a more affordable price. Everybody wins.

Automated Market Makers that we describe in this article are like the stalls at the farmer's market, which hold some inventory of both cash and assets. Anyone can go to them and trade one asset for another; the more they try to buy an asset, the more expensive it will get. Those who deposit inventory into the AMM take a fee when clients trade with the AMM. And when the price moves away far enough from the market price, arbitrageurs will correct it.

Traders and Market Makers sit on opposite sides of the market. Traders go shopping, and the Market Makers (aka Liquidity providers) sit passively with their inventory, ready to accept trades at their advertised price.

A summary table highlighting the differences between them:

 Traders Liquidity Provider Side of the market Price Takers Price Makers Utility Swap one asset for another Hold inventory and are willing to sell on request Information Informed Uninformed Profit potential Large - if the view on the market is correct Medium - profit from holding inventory that goes up in value + fees Perceived Edge Knows where the market will go Has access to capital and has a lower risk tolerance Liquidity Consume Liquidity Provide Liquidity Arbitrage Can be an Arbitrageur Needs Arbitrageurs to keep the price inline Mode Aggressive Passive Fees Pays a fee for every swap Receives a fee from every swap

### Liquidity Providers

Liquidity providers have access to capital and want to use that capital to turn a profit. They do this by providing liquidity to the AMM and taking a fee from every transaction when traders do swaps with that liquidity.

💡
Example:
As a Liquidity Provider, you might hold an inventory of 20,000 USD and 0.5 BTC (bitcoins). You would place this pair of assets into an AMM, and every time someone swaps BTC for USD or USD for BTC, you would receive 0.3% of the swapped amount.

So, if a trader comes to an AMM and swaps 2,000 USD for 0.05 BTC, then you receive a fee of 6 USD for this swap.

After the trade, you will hold 22,000 USD and 0.45 BTC + 6 USD fee.

The liquidity providers benefit when the price of their inventory goes up. Therefore in a rising market, both traders and liquidity providers profit. The kicker for the liquidity providers is that they always collect a fee. This is particularly beneficial in a falling market when collected fees cushion the loss from falling prices.

An arbitrage condition ensures that liquidity providers collect fees in a rising and falling market. The fees are higher in a rising market but also are a source of income in a falling market as this is when volatility increases and traders do more swaps with the AMMs.

Traders go to AMMs to swap one asset for another. When doing the swap, they effectively give the AMM a bit of their asset, and the AMM disposes back to them the asset they want. And because traders are dealing with a smart contract, this exchange is done without a human or a bank involved. The trader does the exchange with a smart contract that holds inventory in both of these assets. The liquidity providers deposited the liquidity into the smart contract.

When the trader does a swap, he changes the composition of the inventory and the price in the liquidity pool. Therefore, a large swap will have a significant impact on the price.

💡
Example:
The original inventory in the AMM is 20,000 USD and 0.5 BTC which implies a live price of 20k/0.5 = 40k per BTC.

When doing a swap the trader would effectively deposit 2k USD and expect to receive 0.05 BTC from the AMM.

The change in inventory would result in a new price of 22k/0.45 = 48k per BTC in the AMM*.

The price of an asset in a liquidity pool results from the inventory in that liquidity pool, which is a very useful outcome. The supply and demand in the liquidity pool decide the price.

* The example ignores the "constant product" requirement for simplicity of the illustration

### Arbitrageurs

Arbitrageurs are essential for a good functioning AMM. Arbitrageurs are sophisticated traders who recognize that they do not have the information on where the market will go, and they neither care if the market goes up or down. All they care about is if there is a price discrepancy between different AMMs

An arbitrageur constantly scans for price differences between exchanges, and as soon as he notices the price on one exchange moving by a significant amount - either because someone did a huge swap and changed the inventory composition of the AMM and skewed the price or because the market has moved. Then, the Arbitrageur would do two mirror trades that lock in a profit in either case.

💡
Example:
A trader did a large swap on an AMM and moved the BTC price from 40k to 48k. The price at the other AMMs and the Centralized Exchanges is still 40k

The Arbitrageur would buy a fraction of a BTC on another exchange for 40k and then sell it on the local exchange for 48k, this way locking in a profit of 8k per BTC and converging the prices on both AMMs.

### Flash Loans

A fantastic nuance for Arbitrageurs is that blocks on a blockchain measure time. This nuance might be difficult to grasp at first. Time stops between blocks. A block is the smallest unit of account of time, and there can be many seconds between blocks.

Measuring time in blocks creates a concept in crypto trading that does not exist in the traditional financial industry called Flash Loans.

In a flash loan, a particularly sharp Arbitrageurs can:

1. Borrow some funds without collateral;
2. Buy a cheap asset on one AMM;
3. Sell it on another AMM at a higher price;
4. Collect a profit and return the loan;
5. Do it all within the same block;
6. If the trade is unprofitable, the loans don't even start!

There is a look back in time where the taking out of a loan can be conditioned on the trade being profitable, or otherwise, the combination of transactions doesn't take place. This creates a valuable tool for arbitrageurs who can now scan for trade opportunities and execute a trade in any size if they find one by using these flash loans. In the traditional financial system, they would need to have access to large amounts of capital and run a risk of a trade going wrong in one of the steps.

The widespread use of Flash Loans makes the AMM market extremely efficient.

## How do AMMs work?

An AMM holds an inventory of two assets; their relative inventory amounts determine the relative price of the assets in the AMM. This relation is valid for all AMMs. Therefore, the price is internal to the AMM.

Most AMMs follow the so-called "constant product" formula and the more sophisticated AMMs follow a modified constant product formula. These are sometimes referred to as the Uniswap V2 model and the Uniswap V3 model to distinguish between the simple constant product formula and the more advanced ones.

The simple Constant Product Formula of an AMM is:

$X * Y = K$

Here X is the inventory amount of one asset (e.g., 20k USD), and Y is the inventory amount of the second asset (e.g., 0.5 BTC). K does not have a meaning; it serves as a constraint.

For a liquidity pool, this formula needs to hold at all times, and the K can only increase as fees accrue, or when new liquidity providers increase the inventory of both X and Y assets. Over time K will gradually increase as swaps are done with the liquidity pool and the 0.3% fee from each trade gets added to the pool

💡
Example:
A pool that starts with 20,000 USD and 0.5 BTC has a K value of 10,000

When someone swaps 2,000 USD for BTC, he deposits 2,000 USD into the liquidity pool and gets back 0.05 BTC. The new price at that AMM becomes 48,400 while the K remains at 10,000 *

If someone decides to swap 10,000 USD for BTC he would only get back 0.17 BTC at a price of 10k / 0.17 = 58k per BTC and move the pool's price to 90k USD per BTC. This is clearly not a very good price to be trading at and this is due to the large size of the swap relative to the size of the original inventory.

* The impact of the 0.3% fee is ignored for the moment

The following table and chart illustrate how the constant product formula enforces the price at an AMM and ensures that a trade is possible at any price, although for large trades the price becomes uneconomical.

A convenient feature of the constant product formula is that it ensures that after inventory is deposited into a liquidity pool no further maintenance is required. And it ensures that a price is always available.

### Providing Liquidity with Leverage

The constant product formula for AMMs was first popularized by the founder of Ethereum and made into a product by the founder of Uniswap. Versions 1 and 2 of the Uniswap protocol used this constant product formula until they released Version 3 which made an improvement by introducing leverage

The improvement was introduced to address the "capital inefficient" of the constant product formula.

Capital inefficiency means that you need to put up a lot of inventory, the majority of which is not used in the trades, but needs to be there to guarantee a full range of prices from $$-\infty$$ to $$+\infty$$. The capital inefficiency is particularly severe for assets that are expected to trade within a tight range, such as pairs of stable coins USDC, USDT, UST ... Stable coins are all pegged to USD, and absent the peg breaking, one would expect them to trade within a tight range around 1 (be able to swap 1 USDC for 1 USDT, or very close to that price). Therefore depositing large amounts of inventory to cover the full spectrum of outcomes for something that is expected to trade within a tight range might seem wasteful. Uniswap V3 addresses this weakness by changing the constant product formula.

The new V3 mechanism requires the liquidity providers to give a thought to how to set the new parameters when providing liquidity. These parameters control the leverage that is applied to the constant product formula. And this leverages generates higher fees for the liquidity providers, although there are new risks as well. The main risk is that fees will stop accruing altogether if the market price of the asset reaches certain bounds.

The new parameters that need to be set are the price levels beyond which the liquidity provider is happy to hold all his capital in one of the assets. And if one of these levels is reached then the liquidity provided stops providing liquidity and stops earning fees.

💡
Example:
Providing liquidity of 20,000 USD and 0.5 BTC to a Uniswap V3 type liquidity pool requires you to set the lower (Ra) and upper bound (Rb). These are the bounds beyond which you are happy to be left with an asset that is losing value.

Setting the lower bound at 10k per bitcoin and the higher bound at 70k results in leverage of ~2.7, which means that the fees to the liquidity provider will be 2.7 times higher

But, if the price of BTC rises above 70k then you will be left with all your liquidity in USD. And if the price falls below 10k then you will be left with all your liquidity in BTC.

The table below shows how providing liquidity with leverage affects the amount of inventory at different price levels. The continuously available liquidity between $$-\infty$$ to $$+\infty$$ is no longer possible and if the price falls below 10k, or rises above 70k this inventory is no longer used and therefore does not generate fees.

A little bit of history on the Uniswap roadmap. Uniswap V2 was first released as an open-source project and very quickly became the top project on Ethereum in terms of the number of users and TVL. And given its success, many cloned it to the point where 2/3rds of all AMMs today, across all blockchains are essentially clones of Uniswap V2.

Later in 2021 Uniswap released its V3, but this time to avoid such a rapid proliferation of clones it introduced a restriction in its license agreement forbidding anyone to clone it for 2 years. And as a result, today it holds the monopoly on this new mechanism.

A trader who wants to trade with leverage (on borrowed money) would first do a swap for the asset that he thinks would go up in value. And then take that asset to a lending protocol such as AAVE or ANCHOR and deposit his asset there as collateral so that he can borrow more USD against this collateral. Then he would take this USD and swap them again for the same asset, and then go deposit it again as collateral. This can be repeated multiple times. The biggest risk with this strategy is if the price of the asset goes down, and if it goes down far enough then the lender who provided the loan will foreclose on the loan and keep the collateral.

Trading with leverage is extremely dangerous, exercise care and understand what are the risks involved. The lender from who you borrow will not hesitate to sell your collateral if markets move against you

This is particularly dangerous as a seemingly healthy collateralization level can get foreclosed on by a sharp and short-live market drop driven by a cascade of liquidations.

### Effect of Volatility on Fees

If there is volatility in the market then there will be trading done. This is a necessary condition for AMMs.

Volatility is good for liquidity providers. Volatility encourages traders to trade and  generate more fees for liquidity providers

Liquidity is provided at a certain price level of the market and if the market moves on other exchanges then the arbitrageurs have a very strong incentive to bring the prices in line and make a profit while doing it.

In order for the trade to be interesting for an arbitrageur, the price needs to move by a minimum amount that is higher than the costs that the arbitrageur would incur when doing the trade. This cost can be quantified because most of the AMMs charge the same 0.3%.

The price needs to move by 1x the transaction fee of 0.3% + 0.075%. The 0.075% is the transaction fee on the cheapest and most liquid centralized exchange (Binance). So, for the arbitrageur to do a swap on an AMM the market price needs to move by at least 0.375%, up, or down. A price move smaller than that would not turn a profit for an arbitrageur and will be ignored.

The critical market move to look out for is 0.375%. There is also competition between arbitrageurs, so while one arbitrageur waits for the price to move by more than that another one would come and undercut him. It could be argued that as some arbitrageurs already have inventory they wouldn't mind hedging it when the price moves by 0.3% rather than wait for 0.375%

The market price of an asset needs to move by just over 0.3% for a trade to be made on an AMM by an arbitrageur to keep the inventory balance in AMM in line with the market price. Therefore in a volatile market there will always be trades on a AMM and liquidity providers will always earn a fee

The arbitrageur will trade the amount that is just enough to bring the prices on the AMM back in line with the market. This amount is proportional to the amount of liquidity in the liquidity pool and the size of the price move, and can be estimated as follows:

To find the change in USD inventory you need compute the elasticity of inventory to price as $$\frac{0.5*K*Price}{\sqrt{K*Price}}$$ and then multiply this by the % change in price. Where K is from constant product formula
💡
Example:
In a liquidity pool with 200k USD and 5 BTC, a change in the market price of BTC by 5% would result in a change in USD inventory by 5k USD (from 200k to 205k)

The liquidity provider would take a fee of 15 USD and the arbitrageur would make 228 USD in profit from doing the 5k swap

It is profitable for the liquidity provider when the market moves, but it is even more profitable for the arbitrageur

### Negative Gamma when Providing Liquidity

Providing liquidity into a liquidity pool pays fees from the traders who consume that liquidity by doing swaps. So there is a stream of fees to the liquidity provider. However, the liquidity provider is always on the wrong side of where the market is going. Traders go to a liquidity provider for liquidity. And when the market is rising, the traders are buying, which means the liquidity provider is selling.... and selling when the market is rising is not a good thing for profit

When the market prices move the liquidity provider is always on the wrong side of the market . When the market is rising, the traders go to the liquidity provider to buy that asset, and when the market is falling the traders go to the liquidity provider to sell him the asset.

The liquidity provider always suffers from "negative gamma" which in the trader's lingo that if the market moves then he will be worse off than he started. And when the liquidity provider has negative gamma the trick is to make more profit from fees than what he loses from the negative gamma.

This is similar to selling options. When you sell an option you give someone an option to buy from you an asset at a certain price in the future (called the strike price). The option is very cheap if the strike price is very far away, but gets more expensive as the price rises and gets closer to the strike. This increase is not linear. And this no linearity is called the gamma effect.

💡
Example:
An investor who deposits 20k USD and 0.5 BTC into a pool when the price of BTC is $40k will: + 16k profit if the prices go up by 100% - 11k loss if the prices go down by 50% An investor who holds 20k USD and 0.5 BTC will: + 20k profit if the price goes up by 100% - 10k loss if the price goes down by 50% So the investor who provides liquidity will make less when prices increase, and lose more when prices drop - this is negative gamma But the investor who provides liquidity makes fees ...! The negative gamma is best illustrated with an example against a buy-and-hold strategy. The delta of the buy and hold strategy is always 1 which means for a 1% price in price the value of the portfolio changes by 1%. However, the delta of a liquidity provider is 1 only locally. As soon as the price moves away, even slightly, the change in value becomes less than the change in price - this is negative gamma. ### Impermanent Loss Impermanent is the loss of value of your portfolio when providing liquidity to a liquidity pool compared to not providing liquidity. The comparison is relative, it is not an absolute loss of value. This is important. When the market is going up the market value of the pool in USD terms might also be going up, but you will still have an impermanent loss. So the loss is relative, not absolute When trying to explain this to someone who has never provided liquidity to an AMM, but knows a little about Finance and Accounting it helps to frame the concept as Marking an asset to Market in the liquidity pool and then comparing it to the Mark to Market of a buy and hold strategy. The difference between the two is the impermanent loss. However because DeFi and AMMs were built by engineers, the concept of Mark to Market was alien to them, so they had to be inventive and create some new terms. This is understandable and kudos to them for making the best of clearing out what it is. The impermanent loss appears every time the market prices move. Traders will trade with the liquidity pool and as a result, change its composition. If the price of BTC is going up then traders will swap USD for BTC and as a result, the pool will hold more USD inventory and less BTC. The impermanent loss is the result of losing some of the assets that you initially deposited into the pool and receiving other assets instead. It is a loss because the asset that is increasing in value is taken away and replaced with an asset that is losing value. It is impermanent because you haven't taken the assets out from the pool yet, and it will only become permanent when you do. This concept might immediately look odd to a Finance professional, but remember AMMs were invented by engineers. The notion of time in the word impermanent, in my opinion, should be ignored altogether. The loss is very much permanent at the moment when you are looking at it, and what will happen next in the market is any ones guess. Also, the term "loss" overstates the gravity of the situation, as the loss is relative to not providing liquidity. A better term for it would be "Opportunity Cost"  Providing Liquidity Buy and Hold Changes in Market Value ✅ ✅ Impermanent Loss ✅ ❌ Accrues Fees ✅ ❌ 💡 Example: Someone providing liquidity to a BTC ETH liquidity pool will be exposed to the Risks of: - The Market Value of the crypto market falling and therefore losing value in USD terms - The relative price of BTC ETH changing and therefore having an impermanent loss + Will be compensated by the fees he will collect from others doing swaps with the liquidity pool ## Minimum Fees When providing liquidity into a pool you want there to be a lot of trading going through that pool. You want a lot of traders to come and do swaps with that pool. This is because you will receive a fee every time a swap is done. Because of market volatility there will always be a minimum number of swaps that is done in a year. Why? Every time the market prices move they create an opportunity for arbitrageurs to make a profit by trading with your liquidity pool. And the more volatility in the markets the more opportunities will exist. We ran a few simulations and calculated how much fees a liquidity pool will generate purely from the actions of Arbitrageurs who will work to keep the pool price in line with the market. The amount of fees depends on how volatile the asset is, a lot of volatility brings more trading and more fees, so we ran the simulation for different assumptions of volatility. The volatility for BTC and ETH has historically been between 80 and 100% and for other tokens, it has been even greater, at times exceeding 120%. Note that there will also be impermanent loss and changes in Mark to Market of the portfolio, so the fees should not be judged in isolation. However, if someone is bullish on a token and doesn't mind holding it long-term, then providing liquidity can be a means to higher returns. Assumptions for the simulation: • Time intervals of 1 minute were used and simulated over 1 year (525k minutes) • 1 minute vol was derived using the square-root-of-time rule, where the $$1minVol = \frac{1yrVol}{\sqrt{525600}}$$ • A trade is assumed to be done when the price moves by 0.3% which is the minimum threshold for an arbitrageur to break even on his trade • Price volatility was simulated with a normal distribution We validated the volatility assumption by comparing our estimate against real ETHUSD trade data, sampled in 1-minute intervals. From the real data, we got results that suggest around 80% annualized volatility and around 40 thousand trades by arbitrageurs. This is in line with our simulation. ## What is Farming? Farming is when the Decentralized Exchange (DEX) on which the AMM operates offers its own tokens as rewards to liquidity providers. A DEX will usually split the original 0.3% fee that it earns from swaps into two parts: • 0.25% of the 0.3% fee goes to the liquidity providers and; • 0.05% of the 0.3% fee goes to the holders of the utility tokens issued by the DEX This gives the possibility to the holders of the DEX utility tokens to earn fees by owning the tokens rather than providing liquidity. The utility tokens can either be bought directly from the DEX or from the exchange. The liquidity tokens can also be earned by providing liquidity and then depositing the certificates to earn the utility tokens. This act of depositing certificates of providing liquidity is called Farming. The utility tokens that you receive from Farming can then be sold on the exchange, or kept to accrue fees if you expect the DEX to become successful and attracts a lot of traders. ## AMMs Contribute to Market Stability A large amount of liquidity locked within AMMs reduces volatility in crypto markets. When market participants lock their liquidity in an AMM they stand ready to buy and sell those assets to whoever comes. When the amount of liquidity locked in AMMs is relatively low compared to the size of the demand by retail and institutions, this can cause large price swings, particularly around major news events. For example, when there is a torrent of negative news, the retail investors might panic and try to sell all their inventory by going to an AMM. If liquidity is low at the AMMs the price will move violently and create volatility. However, as the volatility increases the amount of fees that Liquidity Pools generate also increase and this brings more liquidity to the pools as investors take note of higher returns. As the amount of liquidity increases in AMMs the prices become less sensitive to changes in demand and the prices become more stable. So there is a positive reinforcement loop. Higher market volatility drives higher % Annualized Yields that providing liquidity to Liquidity Pools offers. This causes investors to allocate more liquidity to these pools making them better capitalized. This reduces price volatility as Liquidity Pools are better able to accommodate large orders. This creates a self reinforcing cycle ♻️ ## Providing Liquidity vs. Buying and Holding The main reason why someone would provide liquidity to an AMM is to receive a portion of the fees that the liquidity pool generates. But the downside is that they expose themselves to impermanent loss. So the natural question to ask: what is more profitable? To provide liquidity and earn the fees, but lose some value from impermanent loss, or not to provide liquidity and just hold the assets? The answer will depend on the direction of the market and the level of volatility. So for this, we looked at 3 scenarios and a Uniswap V2 type of liquidity pool with$10k TVL of BTC / USD:

• Market Small Up Scenario - a scenario where the prices move sideways for a year and end up +30% for the year. We assumed annual volatility of 70% which is about what the option traders expect the volatility to be long term.
• Market Large Up Scenario - a scenario where prices go up by around 200%. This increase is steady throughout the year with a slight increase in volatility to 90% annualized. This size of move is comparable to the end of 2020 and the start of the 2021 market bull run.
• Market Down Scenario - a scenario where prices go down by around 75% and the volatility increases to 120%. The drop in prices leads to panic selling and opportunistic buying such as seen in March 2020 during the height of the Covid pandemic when BTC fell to a low of 3k and then recover to over 10k in the same year.

We also made a conservative assumption on fees. We assumed that the fees are generated only by arbitrageurs who trade with the AMM to keep its price in sync with the rest of the market. In the real world, traders take a view of where the market will go and trade with the AMM based on that view thereby generating more fees. Therefore, under real market conditions, we would expect fees to be higher.

Looking at each of the simulated scenarios

In a Market Small Up Scenario, providing liquidity into a liquidity pool generates circa 10% in fees and there is no impairment loss as the buy-and-hold strategy does not significantly increase in value.

In a Market Large Up Scenario, a buy-and-hold strategy can be more profitable than providing liquidity to a liquidity pool, but not by much, as providing liquidity generates fees which to a large extent compensate for the impermanent loss. The amount of fees modeled here are the minimum fees generated by arbitrageurs, in the real world, traders taking a view on the market and doing swaps with the AMM would increase the amount of fees.

In a Market Down Scenario, providing liquidity also under-performs the buy-and-hold strategy. In a particularly severe downturn of -75%, the size of the impermanent loss is roughly 25% of the starting portfolio value.

The conclusion is then that the minimum amount of fees that are generated by arbitrageurs, offset to a large extent the impermanent loss of providing liquidity. And the biggest risk for a liquidity provider is a large market downturn which would leave him worse off than if he was just buying and holding the assets.

Summary table with the direction of the portfolio and its components in the different scenarios