As decentralized exchanges (DEXs) evolve, their functionalities become more and more advanced, often matching those of centralized exchanges (CEXs). One such functionality is the ability to place limit orders, which offers more flexibility and efficiency to DEX traders. This article looks at the existing limit order features and their prospective implementations.
Unlike a market order, which is executed immediately at the last market price with potential slippage, a limit order is executed at a predefined price as soon as it is reached. Market orders are used by default in all automated market maker-based DEXs. They are simple and straightforward for beginners. A market order is guaranteed to be executed or fail due to parameters, such as the maximum price impact.
In turn, limit orders are intended for more advanced traders, since they require analyzing the market situation and assessing the probability of an asset’s price reaching a specific level. Considering filling limit orders on a blockchain also requires taking gas costs into account, which, based on order size, could make the trade more or less profitable.
Still, limit orders are a great tool for professional market makers that can significantly increase the profitability of trading.
Just like CEXs, a range of decentralized protocols — including SushiSwap, the 1inch Limit Order Protocol and 0x — offer limit order functionality. As a result, advanced features never before seen in DeFi, have been made available, including request for quote (RFQ), dynamic pricing and conditional execution.
Request for quotes
RFQs can be viewed as over-the-counter (OTC) systems for decentralized trading that enable market makers to bridge liquidity from CEXs to DEX users. That provides better pricing for large and medium-size trades.
An RFQ system aims to make providing significant amounts of liquidity to DEXs easy and profitable while also reducing risks. Because market makers can choose when and with whom they want to transact, they can maximize their ratio of retail order flow to arbitrage flow.
The RFQ feature enables primary market makers (PMMs) who normally trade crypto assets on CEXs or OTC options, to trade large amounts of crypto with low risk on DEXs. Thanks to the RFQ, PMMs bring substantial liquidity from CEXs to DEXs.
If, for instance, a user wants to swap 1,000 Ether (ETH), a limit order protocol reaches out to PMMs, asking them if they’ll do this swap. If they are interested, they send a signed order. Once the order has been executed, a PMM sells the 1,000 ETH on another chain’s DEX at a profit, while the DEX takes advantage of the liquidity brought by the PMM. Thus, PMMs effectively bring CEXs’ and other chains’ liquidity to DEXs.
In addition, RFQ offers better gas efficiency. While the filling of a simple market order would cost 90,000 of gas, an RFQ order would cost just 70,000 of gas (these figures are approximate).
Conditional execution and dynamic pricing
The 1inch Limit Order Protocol’s conditional execution and dynamic pricing features could facilitate a range of functionalities. Thanks to conditional execution, users can maximize their earnings on trades by specifying conditions for order execution. In the dynamic pricing feature, swap prices are calculated by smart contracts, based on demand and supply.
One promising use case for dynamic pricing is auctions. A limit order can be placed in such a way that the price will increase or decrease (as in a Dutch auction). Similarly, the dynamic pricing feature can power initial DEX offerings and other token sales based on the auction model or nonfungible token (NFT) auctions.
Related: How much intrigue is behind Kusama’s parachain auctions?
Stop and trailing stop orders
Another example of the implementation of conditional execution and dynamic pricing features could be stop orders and trailing stop orders.
Stop orders are only placed when specific price conditions are met, with price data provided by oracles. For instance, “Sell wETH at $2,000 when the oracle price is lower than $2,100.” Stop orders can be used in combination with market or limit orders, which offers traders more flexibility and a chance to create more complex strategies.
Basically, the difference between limit and stop orders is that limit orders are placed on the order book, and anyone can see them, while stop orders are only submitted when a preliminarily defined price is reached.
Unlike a stop market order, which would say something like “If the price reaches X, buy/sell immediately,” a stop-limit order would say “If the price hits X, place an order to buy/sell at Y.” X and Y can have the same value, but not necessarily.
A combination of a stop market order and a stop limit order would be, for instance: “If Bitcoin’s oracle price is below $30,500, sell Bitcoin at $30,000.”
A trailing stop, also known as a trailing stop-loss, is a market order that sets a stop-loss at a specific percentage lower than an asset’s market price as opposed to a single value. After that, a stop-loss order trails behind the asset as its price changes — hence, the name “trailing stop.” An example of a trailing stop order would be: “Sell wETH if its price falls by $300 from today’s highest price.”
Gas efficiency
We have calculated gas usage for RFQ order execution in four versions of the 0 protocol, as well as those of regular limit and RFQ orders in the 1inch Limit Order Protocol.
The chart below summarizes 90th percentile gas usage of these protocols (applying to 90% of transactions). More gas usage data is available here.
Related: Ethereum Improvement Proposal 1559: Is the squeeze worth the juice?
DEXs aim to offer the same features as CEXs, but in a decentralized environment. And in some aspects, DEXs have already overtaken CEXs, such as, for instance, AMMs. The limit order functionality is a major tool moving the segment forward, narrowing the gap between options offered by CEXs and DEXs.
This article does not contain investment advice or recommendations. Every investment and trading move involves risk, and readers should conduct their own research when making a decision.
The views, thoughts and opinions expressed here are the author’s alone and do not necessarily reflect or represent the views and opinions of Cointelegraph.
Anton Bukov is the co-founder of the 1inch Network, a distributed network of decentralized protocols. Anton worked as a C++ developer and iOS developer and later contributed to crypto projects including MultiToken, NEAR and Synthetix. Anton also co-hosted a YouTube show, CryptoManiacs. At a 2019 hackathon, Anton and Sergej Kunz, the 1inch Network’s eventual co-founder, developed a prototype crypto exchange aggregator that became the basis of the entire network.