By clicking “Accept”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.

Intro to AMMs and Their Particularities - Part 1/4

Each article in this series covers a big segment of real-world AMM pools behavior analysis and IXS mitigation model stress testing, which includes the details and simplified explanations of the work performed.

The detailed report, codebase, and simulation data are open-sourced and continuously updated on our GitHub at

Diving Into the Wild Metaverse of AMMs Article Series

How Traditional Money Exchange Works

In economics, goods are items that add some kind of benefit to the people who consume them and satisfy people’s needs and wants. Virtually anything can be considered “goods” if it offers some kind of benefit to consumers.

The traditional definition of money is an economic unit that functions as a generally recognized medium of exchange for transactional purposes in an economy. Each currency has its recognition, its acceptance on different markets, its guarantees of price, and so on.

These factors define currency prices related to the other currencies.  Considering that currency prices are always changing due to the events happening on the markets, people can get profit out of efficient money exchange and use.

This element corresponds to the definition of goods meaning that each currency can be considered as a good.

Each currency can be exchanged for another one using another person who is willing to change the currency he has on hand to the one he wants. This process is similar to a simple case of selling where one person sells the good to get money or another good in return. In this case, a person is selling one currency to get another one.

For example, Alice is willing to buy some European euros via selling some US dollars using a price of 1.4 US dollars for each European euro. Bob wants to sell European euros and buy some US dollars, but Bob is ready to sell his European euros at a price of 1.6 US dollars per unit, while the real market price is equal to the 1.5 US dollar per unit. This situation is presented in the diagram below.

Diagram 1: Alice and Bob Example of Money Exchange

The difference between Bob’s price and the real price is equal to 0.1 US dollars, meaning that, in case, Bob will sell 100 European euros he will get 160 US dollars while conforming a real price Bob should take from Alice 150 US dollars, meaning that Bob gets 10 US dollars as a profit, while Alice gets 10 US dollars of loss.

The best solution, in this case, ignoring real market currency price, is setting a compromise which also can lead to extreme losses for one of the sides.

The problem of exchange in the current case is that there is no regularization of the currency price and therefore there is no guarantee that exchange will happen with an acceptable and desirable price for both sides. It is a risk and this process requires regularization and centralization.

The centralization problem is solved via using currency exchange companies that are responsible for the regularization of the exchange processes and cooperating with the state. The classic exchange rate formula is presented below:

The problem is that the current exchange rate formula is different and heavily depends on the managed floating exchange rate, meaning that the currency’s value is affected by the economic actions of its government or central bank. This is a separate complex topic, but this article is about another one.

What is an AMM, How It Works, and How It Is related to the Traditional Exchange Businesses?

Cryptocurrencies popularity is rising with achieving new price limits, companies start to accept payments with cryptocurrencies, there are cryptocurrencies ATMs appearing all over the world. Considering that cryptocurrencies’ role is coming closer to the same role as traditional money it is important to find ways of efficient exchange of one cryptocurrency into another one.

Previously it was mentioned that a person is able to perform an exchange of one currency into another via another person willing to exchange the second token into the first one.

This can happen via the P2P selling mechanism, but the problem, in this case, is that token prices are discussed by persons participating in the exchange process and the price may differ from the real-market one, meaning that there should be some regularization applied.

The same problem appears in the case of using face-to-face transactions. For effective cryptocurrencies exchange, it is required to apply some regularization and centralization into this process. This can be achieved using AMM.

Automated market makers (AMM) are part of the decentralized finance (DeFi) ecosystem allowing digital assets to be traded in a permissionless and automatic way by using liquidity pools rather than a traditional market of buyers and sellers. AMM users supply liquidity pools with crypto tokens, whose prices are determined by a constant mathematical formula. This formula is similar to the classic exchange rate formula but looks otherwise:

Where k is presenting a constant balance of assets. This formula regulates token prices meaning that a decrease of available token A and an increase of available token B will increase the token A exchange price for token B. Such a structure means that token prices are regulated by the principle of supply and demand, when high demand on token A raises its price, considering that there are more exchanges of token B to token A.

Picture 1: Chart Representing Price Estimation Based on the Supply and Demand

Market Clearing Price (MCP) is a price that forms a balance of supply and demand (in other words, when supply is equal to the demand of the good). AMM is based on a similar principle.

This regularization works in terms of a liquidity pool (each pool is representing something like a “vault” for a pair of tokens), but how are those pools formed and supported? Pools are formed and supported by persons or organizations called liquidity providers by adding funds to liquidity pools.

In return for providing liquidity, liquidity providers earn interest out of the fees for the trades involving this pool. Liquidity providers get rewards according to the hardcoded rule from smart contracts (in the Uniswap V2, 0.3% charges go to the liquidity providers) running on the blockchain.

Token price changes depend on the pool size. It means that with a bigger pool size it is harder to cause token price change. To understand how it works can be considered a classic exchange rate formula with two examples of different pool sizes and how buying token A via selling token B cause different token price changes:

Original token A price related to token B is equal to 1 and the person requires selling 100 B tokens to buy 100 A tokens. In the first case token, A price changed by 19%, while in the second case price changed by 0.02%. Transaction value is the same and the only difference is in the size of the pool (how many tokens there are). This clearly shows that the rise of the token pool size stabilizes price deviations.

Now imagine a situation of a trader that has to perform token B selling to get token A. This person is interested in getting more token A, meaning that the second case of pool size is more attractive, considering that price changes are more stable. In the first case, a person will get 81 units of token A via selling 100 units of token B while in the second case a person will get 99.98 units of token A via selling the same amount of token B units.

This difference between the desired selling price and the real one at the moment of transaction is called slippage (note: on blockchain slippage might be caused by different technical aspects as well, as well as other blockchain system manipulations). Below is presented the diagram demonstrating how the AMM supply and demand regularization principle is working.

Diagram 2: How AMM Supply and Demand Price Regularization Works

Each transaction on the AMM causes changes in the token balance meaning changes in the token prices. Big transactions are able to break this balance causing extreme price changes and to prevent that markets apply exponential premium for each additional unit of the extracted token, meaning that premium is rising with a smaller amount of token available in the pool.

It is unlikely that a trader will perform a transaction that has a high premium and therefore it will cause smaller transaction values. This mechanism stimulates transactions to have values respective to the pool size.

Traditional markets have the same problem of big transactions (most often this problem appears in securities trading) that are influencing price distributions. In order to prevent big transactions from the negative impact on an AMM market there is used a time-weighted average price (TWAP) is calculated by the formula:

Where Close is the closing price when the day is closing, Open is the price when the day is open, Low is the lowest registered price during the day, High is the highest registered price during the day.

In traditional markets, big transactions are performed using TWAP to minimize the negative impact on the market. TWAP can also be used on the AMM market for transaction regularization (serving mostly as a consultative rather than reactive mechanism), however, the working principles are different; this will be reviewed closely in the third article of the series, due to the slightly complex working principle. At the current stage, it is enough to know that a similar concept can be used to stabilize the AMM market.

An additional problem that appears on the AMM market is the impermanent loss that appears when the price ratio is changing after the moment when investors deposited money (tokens) in the pool. The larger this change is, the bigger is the impermanent loss. When the price ratio changes a lot it is more profitable for liquidity providers to hold the tokens instead of adding funds to a pool. The trading fees might mitigate the losses, but it is still important to consider the risks.


Considering all mentioned above rules, properties, and principles of the AMM they are similar yet very different to the traditional value exchanges. This is an efficient organization type that allows traders in a faster, decentralized, and guaranteed manner to exchange their crypto compared to other exchange variants as well as leverage the value of the dormant crypto holdings.

The next articles there will be detailed the reasons why it is important to perform AMM analysis, run market simulations and stress tests of model adjustments; explain how these can be performed; give a deeper explanation of the AMM working principles and properties and why in-depth analysis of a myriad of real markets is a must for decision making. Until next time.