Onomy Protocol
Published in

Onomy Protocol

An Analysis of Automated Market Makers vs. Order Books

Decentralized finance has given the world a different, and noticeably better, way to trade and earn passive income from cryptocurrency. Before DeFi existed, trading of digital assets was conducted via CEXes (centralized exchanges) which retain control over private keys, trading parameters, user information, and fund security. There also weren’t as many methods to earn passive income from current token holdings, leaving natural occurring value add as the only means of securing portfolio growth.

DeFi’s rise preserves the crypto ethos of trustlessness, reforming an arguably stagnant ecosystem that was falling prey to centralized control. One of its core advancements was the introduction of decentralized exchanges built under the automated market maker (AMM) model. This leveled up the playing field, bringing crypto-style trading with no restrictions, full anonymity, and quick settlement to the table.

Centralized exchanges have kept their upper-hand thanks to their ease of use and professional trading tools, two components connected to the order book-based trading interface. Although decentralized trading has gained tremendous popularity over the past few years, it constitutes an entirely different process than traditional exchange order books.

What are AMMs?

Automated Market Makers are systems that allow for automated cryptocurrency trading, via the permissionless and non-custodial capabilities of smart contracts. Unlike order book exchanges, where users must wait to have their limit orders fulfilled, AMMs process all transactions automatically, without relying on third party buy/sell requests for the token being traded.

The AMM model uses liquidity pools, or collections of crypto tokens, to make trading possible via an algorithm that sets the token prices based on the changing ratio of tokens supplied. Liquidity providers (LPs) or market makers, are those who supply liquidity to pools in the form of digital assets. In return, they’re rewarded with trading fees proportional to how much liquidity was initially contributed.

It’s important to note that in order to deposit funds into a pool, an equal amount of liquidity per token needs to be supplied. For example, $100 worth of ETH and $100 worth of USDT would have to be supplied to an ETH/USDT pool on Uniswap.

A highly-liquid pool with a copious amount of active traders thrives, whereas low-liquidity pools cause massive slippage and price impact, making them ineffective. Anyone has the ability to become a liquidity provider, given the presence of a Web3-enabled wallet like MetaMask or TrustWallet.

When users initiate trades on the AMM, the smart contract is programmed to automatically send these tokens to the corresponding liquidity pool and exchange them for the parallel token within the pair. As each liquidity pool typically consists of a pair of tokens, the exchange ratio is determined by a specific formula that can be adjusted to revamp the way liquidity pools are structured.

A popular example is the formula for Uniswap’s AMM, which is x*y=k. X and Y are the two different tokens within a liquidity pool, and K is equivalent to the constant.

Another feature offered by AMMs includes liquidity mining (or yield farming) where users can earn protocol governance tokens for supplying liquidity.

Impermanent loss is one factor that LPs face within pools — this is where your deposited tokens lose value due to token price divergence between both assets. Since AMMs cannot automatically balance the exchange rates of tokens, arbitrageurs need to step in and create a match between the token prices of the AMM and external markets. Once the token prices rebalance, the loss is erased, but withdrawing your tokens from the pool when the prices are distorted can result in permanent loss.

Exploring Traditional Order Books

Order books are found on CEXes and keep a record of all of the ongoing trading activity, offering more advanced functionalities that are not present on AMMs.

They display the different sections for buyers and sellers — the sellers’ section consists of asks, while the buyers’ section has bids. Within the order book, the current market price of the asset being traded is always on display.

A benefit of an order book is that there are often multiple different charts in which traders can view the fluctuations of asset prices over select periods of time — these visual mechanisms help with more informed decisions based on the available data. Advanced charting engines allow for the deployment of indicators, resulting in handy technical analysis of price movements.

They also allow for users to place limit orders, where you can preset the price at which you want to buy or sell an asset. Once the asset hits your inputted price, the order book will automatically execute the trade for you. This method is especially convenient for those who aren’t frequent traders or don’t have the time to stay alert on price action.

Traditional centralized exchanges typically have much higher volume and liquidity, as well as available tokens and trading pairs, so many often prefer to go this route to get the best possible price with minimal impact. Seldom does one encounter insufficient liquidity on a popular CEX, and in the rare cases this happens, the problem is rapidly amended by the exchange.

Onomy’s DEX — The Best of Both Worlds

Granted that AMM and order book exchange models have their advantages and shortcomings, Onomy Protocol’s hybrid DEX will integrate both architectures, pooling usability, liquidity, security, and functionality within a singular interface suited for emulating the $6.6T per day Forex market.

Whilst the AMM interface works by swapping one asset in the liquidity pool for its correspondent, the ONEX will also allow for order book functionalities, like limit orders, where users attempt to purchase or sell an asset at the best possible price, rather than at a set threshold offered by the exchange. Another function not found on most DEXes is the ability to place a stop loss. This is a long anticipated feature within the trading community as it allows a user to prevent unexpected losses from outstanding overnight positions.

From a technical standpoint, whenever there is a token swap request, the ONEX will first process limit and stop orders placed into the order books. Each limit or stop order execution is processed by the AMM liquidity pool, consequently moving the price while filling the order. The AMM will only fill trades that are introduced within the spread of the order books while charging the ends of the spread to gain a profit for LPs. After the swap is completed and finality is reached, the AMM exchange rate will be settled at the designated price. This leads to having the ONEX set the exchange rate dynamically based on market demand, adhering to the basic principles of pricing set forth by the laws of supply and demand.

Onomy’s ONEX is features a significantly improved user experience, where one may seamlessly engage in Forex trading and retain asset control through non-custodial private key management, while also reaping the more advanced trading functionalities provided by centralized exchanges, like limit orders, stop loss orders, and advanced charting.

About Onomy Protocol

Onomy Protocol is the financial infrastructure sustaining the CeFi to DeFi migration. Users may easily mint, trade, and lend Denoms (fiat-pegged stablecoins) across prominent blockchain economies, in a highly scalable, secure, and efficient process, plugging the $6.6T per day Forex market into DeFi.

Website | Litepaper | Twitter | Discord |Telegram| GitHub | Documentation

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Onomy Protocol

Offering the infrastructure necessary to converge traditional finance with decentralized finance.