Automated Market Makers

0xPredator
4 min readApr 6, 2022

What is Market Making

A market maker is a person or institution that continuously offers to buy and sell a security or other financial asset at a publicly quoted price. Market makers do this by providing liquidity to the marketplace, reducing the costs of trading, and increasing the speed of trading. Market makers are typically large financial institutions, such as investment banks and hedge funds.

The traditional markets are characterized by centralized exchanges where traders can buy and sell securities. The market maker is the key player in these markets. A market maker effectively sets the prices of its financial products on an exchange by constantly buying and selling in order to keep prices steady.

However, the process can be automated. And this is where Decentralized Finance(DeFi) comes in. The DeFi space has witnessed an explosion of automated market-making protocols such as Uniswap, Balancer, Curve Finance, among others. These protocols do not require an intermediary to create liquidity and set prices for a given asset. Instead, they rely on preset algorithms to carry out their tasks.

What is an Automated Market Maker?

An automated market maker (AMM) is an algorithm that provides liquidity for the markets. These algorithms are designed to provide liquidity by mirroring the actions of traders who would be looking to buy or sell at a certain price point. They also provide prices for other traders who may not have been able to find a match for their order on their own.

These automated market makers are computers that automatically make markets in a financial instrument. They buy and sell to maintain a continuous two-sided market, which is the backbone of any liquid financial instrument like stocks, bonds, and futures.

AMMs can be used in both centralized and decentralized exchanges

How does an AMM work?

AMMs use preset mathematical formulas to discover and maintain the prices of paired cryptocurrencies. To explain this further, let’s take Uniswap as a case study.

Uniswap uses a constant product formula to establish the price of paired tokens. The formula is as follows:

x * y = k

Where x and y are the amounts of tokens in a pair, and k is the constant product or liquidity pool balance. You can think of this as a balance sheet that shows the amount of money you have left in your pocket after buying goods from a store. If you have $5 to spend on an ice cream and burger, and you buy them at $1 and $4 respectively, you will have nothing left in your pocket after purchase, which is equivalent to zero liquidity in our Uniswap example. When someone buys more tokens, this liquidity decreases since the total value of x + y is now greater than k (the pool balance). In contrast, when someone sells tokens, more liquidity is added to the pool.

Balancer uses a more complex formula that allows its protocol to bundle up to eight tokens in a single pool. Unlike other protocols, Balancer doesn’t charge fees for trades; it instead rewards liquidity providers who contribute ERC20 tokens to these pools by paying them out in BAL.

What are the benefits of using an AMM?

  • Liquidity — The liquidity available on decentralized exchanges is often not sufficient for large trades. AMMs are able to provide much higher liquidity in situations like these, where the total order book volume on DEXs is insufficient. This makes them a natural fit for high-volume token sales, airdrops, and similar initiatives.
  • Price Discovery — When there is a shortage of liquidity, it is often difficult to ascertain what the actual market price of an asset is. AMMs are able to provide more accurate estimates when there isn’t enough data available due to lack of liquidity.
  • Easy to use — Users no longer have to worry about placing orders or waiting for them to get filled. All they need to do is deposit their assets into the smart contract and trade will be automatically facilitated.
  • Accessible — AMMs are open for everyone who has access to the internet. They remove barriers which used to exist between traditional financial markets and regular people.
  • Decentralized — AMM platforms are decentralized and permission less by nature, meaning that nobody can arbitrarily manipulate prices or stop users from trading as they wish
  • Low fees — In addition to being permission less, AMMs also charge very low fees when compared with other types of exchanges (including both centralized and decentralized ones).

Impermanent Loss

Impermanent Loss is a risk when using AMMs, it is a loss of value that occurs when holding a position in a pool. It happens when there is a change in price between the assets in the pool. Specifically, it occurs in a pool with more than one asset.

Impermanent Loss can only occur when at least two assets are present in an AMM pool. When this happens there are two prices for the asset. One is the market price, which represents the price that you could buy or sell for on an exchange. The other is the pool price, which represents what you would receive if you exited your position via the AMM pool. The market and pool prices are always out of sync, but they tend to move together over time. During periods where they are not moving together, it is possible to experience impermanent loss.

Impermanent Loss occurs in a pool with more than one asset (it does not occur in pools with only one token, because the price cannot change).

Conclusion

In this article, we discussed the history and mechanics of Automated Market Makers. As DeFi continues to mature, Automated Market Makers will continue to be an important component of decentralized exchange infrastructure.

--

--

0xPredator

I write about Crypto Currencies and Hacking Smart Contracts. Twitter: twitter.com/0xPredator Buy me a coffee: buymeacoffee.com/0xPredator