As decentralized exchanges (DEX) evolve, their functionalities are increasingly advanced, often matching those of centralized exchanges (CEX). One of these features is the ability to place limit orders, which offers more flexibility and efficiency to traders using DEX. This article examines the existing limit order functions and their possible implementations.
Unlike a market order, which is immediately executed at the last market price with a possible 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 DEX based on market makers. They are simple and straightforward for beginners. A market order is guaranteed to be executed or fail due to parameters, such as maximum price shock.
For its part, Limit orders are intended for the most advanced traders, as they require analyzing the market situation and evaluating the probability that the price of an asset will reach a specific level. Considering the fulfillment of limit orders on a blockchain also requires taking into account gas costs, which, depending on the size of the order, could make the operation more or less profitable.
Still, limit orders are a great tool for professional market makers that can significantly increase the profitability of trades.
Like CEXs, a number of decentralized protocols, such as SushiSwap, the 1inch limit order protocol, and the 0x limit order protocol, offer limit order functionality. As a result, advanced features never seen before in DeFi have been made available, such as Request for Quotation (RFQ), dynamic pricing, and conditional execution.
Quote requests
RFQs can be considered OTC systems for decentralized trading that allow market makers to bridge the liquidity of CEXs to users of DEXs. In this way, better prices are achieved for large and medium-sized operations.
An RFQ system aims to facilitate and monetize the provision of significant amounts of liquidity to DEXs, while reducing risks. Since market makers can choose when and with whom they want to trade, they can maximize their relationship between retail order flow and arbitrage flow.
The RFQ feature enables Primary Market Makers (PMMs), who typically trade crypto assets on CEX or OTC options, to trade large amounts of low-risk cryptocurrencies on DEX. Thanks to the RFQ, PMMs bring substantial liquidity from CEXs to DEXs.
If, for example, a user wants to exchange 1,000 Ether (ETH), a limit order protocol reaches the PMMs, asking them if they are going to do this exchange. If they are interested, they send a signed order. After the order is executed, a PMM sells the 1,000 ETH in the DEX of another chain at a profit, while the DEX takes advantage of the liquidity provided by the PMM. In this way, PMMs effectively bring liquidity from CEXs and other chains to DEXs.
What’s more, RFQ offers higher gas efficiency. While the execution of a simple market order would cost 90,000 gas, an RFQ order would cost only 70,000 gas (these figures are approximate).
Conditional execution and dynamic pricing
The conditional execution and dynamic pricing features of the 1inch Limit Order Protocol could facilitate a number of functionalities. Thanks to conditional execution, users can maximize their profit on trades by specifying order execution conditions. In the dynamic pricing function, the prices of exchanges are calculated by smart contracts, based on demand and supply.
A promising use case for dynamic pricing is auctions. A limit order can be placed so that the price increases or decreases (as in a Dutch auction). Similarly, the dynamic pricing function can feed initial DEX offerings and other token sales based on the auction model or non-fungible token auctions (NFT).
Stop and trailing stop orders
Another example of the application of the conditional execution and dynamic pricing functions could be stop and trailing stop orders.
Stop orders are only placed when specific price conditions are met, with price data provided by the oracles. For example, “Sell wETH at $ 2,000 when the oracle price is less than $ 2,100.” Stop orders can be used in combination with market or limit orders, offering traders more flexibility and the ability to create more complex strategies.
Basically the difference between limit orders and stop orders is that limit orders are placed in the order book and can be viewed by anyone, while stop orders are only presented when a preliminarily defined price is reached.
Unlike a market stop order, which would say something like “If price reaches X, buy / sell immediately”, a stop-limit order would say “If price reaches X, place a buy / sell order at Y” . X and Y can have the same value, but not necessarily.
A combination of a market stop order and a limit stop order would be, for example, “If the Bitcoin oracle price is below $ 30,500, sell Bitcoin for $ 30,000.”
A trailing stop, also known as a trailing stop-loss, is a market order that sets a stop-loss at a specified percentage lower than the market price of an asset, rather than a single value. From there, a stop-loss order follows 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 $ 300 from today’s highest price.”
Gas efficiency
We have calculated the use of gas for the execution of RFQ orders in four versions of the 0x protocol, as well as that of the regular limit orders and RFQ in the 1inch limit orders protocol.
The chart below summarizes the 90th percentile gas usage of these protocols (which applies to 90% of transactions). You can check more data on gas usage here.
DEXs claim to offer the same features as CEXs, but in a decentralized environment. And in some respects, DEXs have already outperformed CEXs, like, for example, MMAs. Limit orders functionality is an important tool that moves the segment forward, bridging the gap between the options offered by CEXs and DEXs.
This article does not contain investment advice or recommendations. Every investment and trading move involves risk, readers should do their own research when making a decision.
The views, thoughts and opinions expressed here belong solely to the author and do not necessarily reflect or represent the views and opinions of Cointelegraph.
Anton Bukov is the co-founder of 1inch Network, a distributed network of decentralized protocols. Anton worked as a C ++ developer and iOS developer and later contributed to cryptocurrency projects such as MultiToken, NEAR, and Synthetix. Anton also co-hosted a YouTube show, CryptoManiacs. At a 2019 hackathon, Anton and Sergej Kunz, the eventual co-founder of the 1inch Network, developed a prototype cryptocurrency exchange aggregator that became the foundation of the entire network.
Keep reading: