Blogs

Automated Market Makers

A Walk Through Order Books and Automated Market Makers

How users buy and sell financial assets is changing; it’s becoming more digital and decentralized. Instead of the traditional way of buying and selling, users are now using exchanges and new mechanisms like Automated Market Makers (AMMs) in the crypto market.

With the reevaluation of blockchain and smart contract uses, new models in digital asset exchange are emerging in the financial market mechanisms, particularly the order book. Through order books, buyers and sellers are matched, and offers are provided to traders.

The process relies on commercial matchmakers, which may be vulnerable to manipulation. Now, Decentralized Exchanges (DEXs) automate order books, enabling digital assets to be programmatically exchangeable without the need for intermediaries.

Automated order books balance the market field by significantly lowering the cost of generating liquidity and the risk of market-making profitability and other manipulations.

Are Order Books Outdated?

An order book is a collection of purchase and sell orders; it displays the number of assets sold and offered. It aims to give traders better market information; however, some information may be inaccurate since it runs through a centralized entity.

Generally, in order books, the lower the price, buyers increases; the higher the price, the more sellers are available. Therefore, a reduced trading volume for particular assets results in a greater bid-ask spread, increasing liquidity risks.

On Slippage and Frauds

Multiple buyers frequently fill market orders. In between these transactions, a ‘slippage’ is expected, where the price of assets varies during the trade. Typically, a slippage occurs higher in markets where the order book doesn’t have many active transactions. 

An order book provides insights into a digital asset’s short-term price trajectory. If there are more purchase orders than sell orders, the price may increase due to the buying pressure.

However, these indications are just insights or hints that change at any time. Some order books allow alteration or cancellation of offers while executing the trade.

For example, a fraudulent individual can place sizeable orders they don’t intend to fill to appear as though the market is desirable for trading. New traders who don’t know much crypto space may mistakenly believe that several buy orders are available in the order book, only to see those orders disappear in the middle of trade execution when the fraud cancels the transaction. It then resulted in substantial slippage that even the traders may be unaware of.

Thereby, order books in crypto markets are vulnerable to various abuse or fraudulent acts, including pump and dumps, wash trading, and spoofing. Hence, this creates unstable market conditions and overstated volumes across exchanges.

Although crypto exchanges have openly acknowledged these issues and wanted a secure trading platform, they have reservations about providing enforcement measures. Some regulations may reduce trading volumes which would eventually affect profitability.

Moreover, when rules are passed, and fines are assessed, it shows that the platform was not designed properly and has to be fixed through innovation, not regulations.

This is where automated liquidity comes in.

Automated Liquidity as an Alternative

Liquidity in an exchange aims to reduce market violations, price volatility, and high transaction slippage. The more buyers and sellers there are in a market, the lesser the slippage rate.

With the development of smart contracts run through trading networks, anyone can now generate liquidity for an automated market maker. To do this, users should invest and deposit crypto funds through a decentralized exchange that enables transparent, affordable, and reliable trading of digital assets.

Automated Market Makers (AMMs) are the best alternative to traditional order books. It appropriately sets the price of digital assets rather than one user providing a price to buy a particular asset from another.

Thereby, an AMM is a digital protocol or technique that runs in all DEXs enabling trustless crypto transactions without the use of any intermediaries. 

In 2018, Uniswap, the first decentralized exchange on the Ethereum blockchain, was successfully launched. Since then, AMMs have become more prevalent in the DeFi space.

So how do automated market makers work?

How Do AMMs Work in DEXs?

AMMs employ a mathematical formula to price assets automatically without any intermediary. An essential part of the process involves liquidity pools.

In a decentralized exchange, a liquidity pool holds a pile of assets that are secured by a smart contract; these assets are locked to provide market liquidity. To set a liquidity pool, asset providers, also known as Liquidity Providers (LPs), must establish a market, depositing funds to liquidity pools.

Pools not only provide liquidity to the market but are also valuable for yield farming, borrowing, and lending, among others.

A liquidity pool consists of two different assets called trading pairs. For example, on a decentralized exchange, you might see asset names (trading pairs) separated by a forward slash as ETH/DAI or USDT/BNB.

In a trading pair, the amount of both assets does not have to be equal. For instance, a pool may include 80% ETH and 20% DAI tokens; other pools can also have proportional ratios.

Any user can contribute and become a market maker by depositing two assets in a liquidity pool where traders transact against the pool instead of directly among traders.

Depending on the DEX protocol, various algorithms are used by liquidity pools; however, all the prices are set algorithmically.

The most common liquidity pool systems, for instance, Uniswap and Sushiswap, employ the below formula:

x * y = k

The Riverex platform also follows the same formula where ‘x’ is the value of token ‘A,’ ‘y’ denotes the value of token ‘B’ being traded in the liquidity pool, and ‘k’ is a constant. According to the formula, every liquidity pool using the AMM protocol must always retain the same overall liquidity of the added or exchanged tokens.

For example, an ETH/DAI pool has 10 ETH and 30,000 DAI tokens. The cost of ETH is computed as 30,000/10, which means 1 ETH is equivalent to 3,000 DAI.

So if a liquidity provider deposits his tokens, he has to follow the AMM ratio price for 1 ETH is 3,000 DAI. Accordingly, if he wants to deposit 5 ETH, he must also deposit 15,000 DAI.

Benefits of Automated Market Maker

AMMs eliminate third parties on an exchange, making the DEX platform completely trustless, a feature many crypto investors values.

Besides making transactions trustworthy and convenient, liquidity providers are incentivized by contributing to liquidity pools. The transaction fees of other users can be used to generate a passive income for liquidity providers of a particular pool.

Through AMMs and liquidity pools, liquidity providers can also gain from yield farming. Yield farming is the practice of using cryptocurrency to get access to liquidity pools and obtain assets in exchange for supplying liquidity. 

In order to maximize their earnings, liquidity providers can move their assets between pools. The returns are often presented as an Annual Percentage Yield (APY).

Conclusion

One of the most significant advances in decentralized finance is the automated market makers. DEXs would not be possible without the AMM protocol, and traders would still rely upon centralized exchange protocols.

Although the AMM protocol is still in its early stage, platforms like Uniswap, Sushiswap, and Riverex use the mechanism and have already successfully tested its functionalities.