Illustrated Guide To The AMM Model (Market Maker Model) of Swap Exchanges

IntermediateDec 23, 2023
This article discusses the significance of Automated Market Maker (AMM) algorithms in economics and their demand perspective in traditional finance. It highlights the importance of swap exchanges and AMM models in the cryptocurrency market, where larger currency liquidity pools are more advantageous for centralized exchanges (CEX), thereby promoting the healthy development of trading pairs.
Illustrated Guide To The AMM Model (Market Maker Model) of Swap Exchanges

The AMM model is one of the most significant innovations in the current bull round of the cryptocurrency market.

AMM, which stands for Automated Market Maker, refers to a market maker model where transactions are automatically executed based on the calculated results.

One of the most well-known exchanges that utilizes AMM is the famous Uniswap, and subsequently, various decentralized exchanges using AMM have adopted similar names such as Sushiswap, ZKSwap, Moonswap, and more.

Illustrate AMM

The Right Branch of the Hyperbolic Curve

In swap exchanges, there is a fundamental model known as the Automated Market Maker (AMM) model:

X * Y = m (where m is a constant). This is a hyperbolic curve model taught in middle school mathematics.

Of course, the AMM trading model represents the right branch of the hyperbolic curve. After all, the quantities of coins in the liquidity pool are positive. Each point on the curve represents the quantities of token A and token B in the trading pair’s liquidity pool.

Asymptotic Lines:

The X-axis and Y-axis are asymptotic lines of the hyperbolic curve. Asymptotic lines are lines that the curve can infinitely approach but can never intersect.

When a point moves along this curve to the right, it corresponds to an increasing quantity of token A and a decreasing quantity of token B in the liquidity pool. The curve can get extremely close to the X-axis but never intersects it, meaning that the quantity of token B in the pool can never become zero.

Similarly, when a point moves upward along the curve, it corresponds to an increasing quantity of token B and a decreasing quantity of token A. The curve can get infinitely close to the Y-axis but never intersects it, implying that the quantity of token A in the pool can never become zero.

Slope:

The slope of the curve at point P is the tangent value of the angle between the tangent line and the X-axis. In other words, it is the ratio of B’ and A’ on the graph.

And the ratio of B’ to A’, precisely represents the ratio of the quantities of token B to token A in the liquidity pool at point P.

The practical significance of the slope is that it reflects the proportion of the decrease in B to the increase in A or the proportion of the increase in B to the decrease in A. This is the exchange rate between token A and token B, i.e., the price.

The asymptotic lines of the hyperbolic curve are the X-axis and Y-axis. As mentioned earlier, this curve will never intersect with the coordinates, meaning that the curve will never become parallel to the X-axis or Y-axis. In other words, the slope of the curve will never become zero or infinite. This implies that the price of A against B and the price of B against A may approach zero infinitely, but they will never truly become zero.

Demand Curve

This seemingly simple model is not something that was thought up on a whim. Its shape is actually consistent with the demand curve. Look up the demand curve online, and you’ll find two types: one is a straight line and the other is curved line.

Tilting towards the lower right:

Whether it’s straight or curved, the demand curve always tilts towards the lower right. The demand curve reflects people’s demand combinations for two goods. Tilting towards the lower right means that when the demand for one good increases, the demand for the other good decreases.

The AMM model’s curve follows the same logic. In the trading pools of the two coins, when the quantity of one coin increases, the quantity of the other coin decreases. Of course, this may sound trivial, but let’s continue to read on.

Diminishing Marginal Rate of Substitution:

In a straight demand curve, the substitution rate between two goods remains constant. From point O to point P, and from P to Q, as B decreases and A increases, the substitution rate between B and A remains unchanged because the slope of the demand curve does not change.

In reality, if you are a boy, and you are asked to play 2 hours less of games and then given a lobster, you may agree. But if the next day you are asked to play 2 hours less again and given another lobster, you may not be as willing. As time goes on, if you are asked to play 2 hours less every day, it may take more lobsters to satisfy you. On the second day, the third day, the fourth day, you would need to eat more lobsters to agree to play 2 hours less. This is the diminishing marginal rate of substitution.

And the curved demand curve can precisely reflect this point.

From point P1 to point P2, from Q1 to Q2, the decrease in demand for good B is equal, while the increase in demand for good Q is significantly different. The increase in demand for good A is less when going from P1 to P2, but it is greater when going from Q1 to Q2.

This is known as the law of diminishing marginal substitution. As the demand for good B decreases, more demand for good A is needed to replace it.

The same principle applies to the two currencies in an AMM trading model. When users exchange currency A for currency B, the amount of currency A in the pool increases while the amount of currency B decreases, causing the point on the curve to move downwards and to the right.

We can observe that as the point moves downwards and to the right, the slope of the curve decreases. This means that as the quantity of good B in the pool decreases, the price of B in terms of A (B/A) increases.

Conversely, when the point moves upwards and to the left on the curve, the slope of the curve increases. This means that as the quantity of good A decreases, the price of A in terms of B (A/B) increases.

Therefore, the design of a swap exchange is based on the idealized demand curve model.

Illustrate Market Making

When users participate in market-making, both the quantities of A and B in the pool increase, causing the point to move in the upward-right direction. Additionally, market-making cannot change the proportion of A and B.

Therefore, the curve after market-making should shift upward and to the right.

The Significance of Swap

What is the significance of swap? Is it just one other place for trading? Is it just a platform for easy token issuance and listing? It is much more than that.

We know that in fact, the trading of two currencies should follow the demand curve. However, in CEX, which refers to traditional exchanges, there can be price fluctuations. Therefore, its curve has waves.

And we know that the slope can reflect the trading price. So, when there is a price difference between CEX and SWAP exchanges, users will engage in arbitrage. They buy coins from SWAP and then deposit them to sell on CEX, or they buy from CEX and deposit to sell on SWAP. Ultimately, this will cause the coin prices on SWAP and CEX to converge.

It is important to note that the equation X*Y=m, where m is a constant, is not a fixed quantity. When more funds are added to the market-making, m increases; when funds are withdrawn from the market-making, m decreases.

In fact, in swap exchanges, all spot trading uses the same model. The specific value of m in this model, as well as the size of the liquidity pool, depends on the market of the two tokens.

AMM is a model that is artificially defined but closer to economic principles. Swap exchanges are like invisible hands in the spot trading market.

On the other hand, centralized exchanges (CEX) may appear to be free but are filled with opportunities for manipulation. CEX may hide visible hands.

The significance of the AMM model in swap exchanges is that it provides a certain corrective effect on CEX, which may seem free but is actually susceptible to manipulation.

The Significance of Market Making

If the size of a swap exchange is very small, it is actually not enough to impact CEX. On the contrary, swap exchanges will become followers of CEX.

As for market-making, we can see that it will shift the AMM model curve to the upper right, making it closer in scale to CEX. Just imagine, if a trading pair has a large trading liquidity pool, price manipulation will be greatly controlled.

The cex curve on the graph is actually an idealized state. In reality, the cex curve is influenced by many factors, including price manipulation. Market-making allows swap exchanges and AMM models to have a greater market influence and can correct certain artificial factors and unforeseen events in cex to some extent.

Final Thoughts

I don’t know if liquidity mining is just a flash in the pan. But swap exchanges and AMM models are remarkable for the cryptocurrency market.

The larger the pool of a certain token pair of trading, the greater the impact on CEX, and the healthier the trading pair becomes. Liquidity mining can also drive the AMM model curve to shift upward to the right within a certain period of time, which is positive for the development of swap exchanges, and even the overall health of the cryptocurrency market.

Even though this positive impact may be temporary, it is still necessary.

Disclaimer:

  1. This article is reprinted from [海盗号 DeFi]. All copyrights belong to the original author [TVBee聊财经]. If there are objections to this reprint, please contact the Gate Learn team([email protected]), and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.
Empieza ahora
¡Regístrate y recibe un bono de
$100
!
Crea tu cuenta