background
image
Order types are missing from DeFi – why is no one talking about this?
12-07-2022
AXO

Trading when the internet goes out, holding assets while you sleep, and placing orders during high price volatility are all ways your assets could lose value in a market. How can you manage these risks and protect your profits or minimize losses?

In Decentralized Finance (DeFi), you can’t — at least not yet.

Every market participant is either looking to get into the market (buy) or get out of the market (sell). Order types define how this will happen, and the ‘how’ can make a big difference to a trader’s success and overall experience.

Current generation Decentralized Exchanges (DEXs) have focused on solving peer-to-peer trading (P2P trading), it’s a good foundation, but it has come at the expense of order types. Order types are the language of market participants, conveying their true intentions and creating market sentiment. In traditional finance (TradFi) and on centralized exchanges (CEXs), order types allow market participants to manage risk, eliminate the need for constant supervision, increase privacy, manage multiple trades, and trade with precision.

If we look at where the majority of transaction volume is, we can see a correlation between the functionality of exchanges and market participation (see graphic below).

Amount of Transactions by Exchange

(October 2021, Axo whitepaper p. 69.)

Most trading volume is happening on TradFi exchanges, followed by CEXs, with trading volume on DEXs coming a distant last. Fewer people are trading on DEXs because it doesn’t provide them with what they need. DEXs only offer one order type — three at best — as opposed to hundreds offered by TradFi exchanges.

Expanding the ways users can interact with the market (more order types) incentivizes higher market participation — as more people or institutions are able to manage their risk and trade how they want, the market opens up to a wider variety of market participants. The increase in market participants creates higher liquidity and more market information, which contributes to a tighter bid-order spread and stabilizes markets — encouraging further market participation.

Without order types, we are sidelining billions of dollars (USD) in potential capital from market participants who do not have the tools they need to participate in DeFi. To Understand why market participants demand them and how creating them can exponentially expand DeFi, we need to look at the utility and purpose of order types for market participants.

The fundamentals of an order

Every order type’s foundation is a market or limit order. Most DEXs use swaps to facilitate P2P trading (albeit with inefficiently modeled liquidity), essentially a market order but filled by an algorithm. However, DEXs have not yet been able to solve the technical puzzle of implementing limit orders. Let’s look at the utility of both so we can see how all order types are built.

Limit orders

A limit order is an intent to execute an order at a specific price. Traders specify the price at which they are willing to exchange their assets and how many assets (the volume) they want to have filled or are offering at that price.

A limit order is the only order type that is constantly visible to the market. They create and build an exchange’s order book (see an order book example below). The order book represents market sentiment, a visualization of where market participants want to get in or out of a market. The midpoint of an order book is the market value of an asset (which in TradFi or on CEXs is technically the last price exchanged). An exchange occurs when a buy order matches with a sell order and ‘crosses’ the order book or vice versa.

Order Book Example

Limit orders sit on the order book until a buy or sell order matches or beats its listed price, at which point the order begins to be filled. It might take one or multiple orders — depending on the volume of the limit order and the volume of the new orders — to complete a limit order and remove it from the order book. If there is not enough liquidity to support all the volume, the limit order remains on the market partially filled (less volume) but at the same price point. Traders can cancel a partially filled limit order at any time.

Limit orders can automate a basic risk management strategy to preserve profits and limit losses (limit the impact of slippage). They guarantee a specified price or better (if executed) and, perhaps just as importantly, eliminate the need for the trader to constantly monitor a market to get that price. But, they are not a perfect strategy. If the order is not filled before the price moves away from the desired price, a trader may lose out on profiting on an upswing or exiting before a downswing. A trader that values the execution price over their desire to enter or exit a market will prioritize limit orders.

Without limit orders on a DEX, there are no ways to guarantee a specific price, and the market sentiment is much more difficult to gauge without being able to see the limit orders waiting to be filled. For the majority of traders, a limit order is the bare minimum they need for trading — they are non-existent on most DEXs.

Market order

The second essential order is the market order. It is an order to buy or sell a given asset at the best available price, guaranteeing almost instantaneous order execution. Market orders guarantee execution by taking the market price even if it moves while executing. A market order will move through the liquidity reserved in an order book (by the limit orders placed) until it has eaten up enough limit orders to fill the order. Because there may not always be high liquidity around a market price, market orders are susceptible to slippage (also known as fill price), which means the order may be filled at a price vastly different from the originally quoted price.

Market orders are typically used when a trader’s need to exit or enter into a trade outweighs the desire to control the execution price.

The majority of DEXs use swaps, which are fundamentally market orders executed by an algorithm. Because they are often implemented on protocols that inefficiently manage liquidity with AMMs, the risk of slippage is drastically higher when compared to TradFi or CEXs.

Limit orders and market orders form the basis of all order types, but on their own, they are not perfect strategies. Most market participants demand more. Let’s look now at how adding conditions to order types can increase their utility further and expand markets to more market participants.

Adding basic conditions to your order

To accommodate more market participants, we can add conditions to a market or limit order that help with risk management, take emotions out of trading, enable us to manage multiple orders at once, and trade with higher precision.

Price condition (stop/touch)

The market value of an asset is constantly moving, so the time (or price) at which a trader gets in or out of a market essentially determines their success or failure — this is the foundation of trading. Constantly monitoring a market to catch the right price is an unrealistic strategy, especially in highly volatile markets or when trading in multiple markets at once.

Limit orders can help mitigate some of the risks of price movement, but as we know, they are not guaranteed to execute. We might also consider that if a trader puts a limit order into the market, they are making their intention to buy or sell public. Intent alone can affect the price of an asset, moving the market price further away from the limit order’s trigger price.

A trader might want to add a condition to their market or limit order to execute only when the market value hits a ‘trigger price’ (specific price point). These conditions are called stop or touch conditions — fundamentally, they function the same way.

Let’s first look at a few examples of how a trader can use price conditions to secure profits and hide their intent from the market until the most opportune time to enter or exit a market.

Market If-Touched (MIT) Order – For Market Entry

A market-if-touched order (MIT) is a condition placed on a market order set to execute at a trigger price. If a trader sets the trigger price below the current market price, they can leverage the strengths of a market order (guaranteed execution) to capture an asset at a lower price during a downward price movement. In this instance, the MIT effectively combines the benefits of guaranteed execution from a market order with the ability to specify (to a degree) a market entry price.

Limit If-Touched (LIT) Order – For Market Entry

A limit-if-touched order (LIT) is a condition placed on a limit order to execute at a trigger price — the trader can specify both the trigger price and the limit price, giving them more flexibility. Suppose a trader moves a large amount of capital or trades in a market with low liquidity. In that case, a limit order can substantially impact the market value of an asset as its intent is revealed. To help mitigate the risk of price movement, a trader might want to hold out until a price moves closer to their desired price point before triggering their limit order to increase their chances of execution.

Stop Loss Order – For Market Exit

A stop-loss is one of the most common conditions in trading. It instructs a market order to execute at a trigger price set below the entry price (the price they purchased their asset). When a trader enters a market, they risk that the market value of their asset might drop. A stop-loss enables a trader to set how much loss they are willing to accept before exiting the market. Because a stop-loss executes a market order, execution is guaranteed, but the price may still drop as the order is filled.

Trailing Stop Loss Order – For Market Exit

A trailing stop loss is a slightly more complex price condition. It instructs a market order to execute if the price of an asset moves beyond a specified threshold. This enables a stop loss to follow market value until there is a significant enough price movement to trigger the market order. A trailing stop loss enables a trader to potentially get a better price than their initial preferred price as the market moves more steadily in the direction they anticipate.

Though price conditions can help with risk management relating to price movement, they do not negate the intrinsic risk of market orders (price not guaranteed) or limit orders (execution not guaranteed).

Time conditions

Every order placed (market or limit) that is not fulfilled creates idle capital — It is an inefficient use of capital to keep your money in trades that are not executing. For example, suppose 100,000 ADA sits in a limit order for several days. In this case, the trader has an opportunity cost equal to how much ADA they could have received from staking or investing somewhere else.

Therefore, a trader may want to add a time condition to their limit or market order. It’s very simple, a time condition specifies how long an order is active. If the order is not executed within that time frame, the liquidity is returned to the trader, freed up to be put to work somewhere else.

Keeping track of multiple orders can be at best, tedious and at worst, impossible. Therefore, time conditions are imperative to make sure liquidity is not tied up in trades that haven’t been executed.

Price and time conditions are the most basic additions we can add to order types.

Building more complex orders

As traders create and add conditions, they can build more advanced trading strategies by bundling order types together. More complex strategies can help traders prepare for market conditions, which helps mitigate risk and increase trading precision.

Bracket Buy Order – For Market Entry

Above, we discussed conditions that either help preserve profits, prevent losses or initiate an order at a desired price point. A bracketed buy order is an example of a single order that combines different order types to reap their benefits. In a bracketed buy order, a market order is executed at a trigger price (much the same as an MIT) to buy an asset, but the trigger price also executes a sell-limit order priced above the trigger price and a stop-loss priced below the trigger price. The bracketed buy order specifies that the trader will buy the asset if the asset becomes available at a trigger price. If the price moves toward an acceptable profit level, or if the price moves below an unacceptable loss level, they will then sell the asset. This type of trade ensures that the trader can roughly estimate what their profit or loss would be if their initial buy order is fulfilled.

The most advanced trading platforms enable traders to create their order types directly through their API. Not only can they automate redundant, time-consuming tasks, but they can integrate information from outside of a trading platform, like indexes, oracle, news patterns, weather data, and more, to create hypercomplex and high-frequency trading strategies. In professional circumstances, algorithms using the order types and conditions of exchanges can execute roughly 40,000 trades per millisecond across many markets. These types of advanced order types with time and price conditions can be executed through automation as such high trading volume is impossible to be overseen by humans.

Closing thoughts

The most sophisticated trading models and strategies can’t exist without the basics. In DeFi, we are missing the basics and therefore missing out on the majority of traders who demand more ways to interact with the market.

DeFi is critically lacking when it comes to order types. Without order types, we cannot time the market, without conditions, we cannot easily manage risk, and without both, we can’t fully communicate our intentions to the market. Traders simply will not trade on a platform that cannot guarantee some level of risk control and precision.

Order types are the first step for next-generation DEXs and the mass adoption of DeFi. However, the ability to execute algorithmic trading strategies and define all order types as customizable pieces of code is what will truly open the flood gates to retail and institutional capital. Generation Lambda, the team behind Axo, is working hard on its concept of programmable swaps to make that happen. We’ll talk more in future articles on our formally verified language (programmable swaps) for creating financial interaction from order types to passive indexes and sophisticated trading strategies. Soon traders will be able to express their full intention on DeFi and bring their trading strategies to life for themselves and the community. The future of finance is coming.