Toxic Order Flow on Decentralized Exchanges: Problem and Solutions

In this series of posts, co-written with Polina Nezlobina and Nikita Zinoviev, we discuss the main issue faced by decentralized exchanges — order flow toxicity. Other posts in this series: part two, part three, part four.

Alexander Nezlobin
9 min readJul 26, 2022

Introduction

When the order flow is toxic, that is, dominated by arbitrageurs, liquidity providers (LPs) earn low or negative returns on their investment. We will explore the root causes of order flow toxicity and discuss potential solutions to this problem. Our discussion will mostly focus on the current market leader, Uniswap v3. Be sure to read their white paper if you have not done so already.

We will show that the main reason for the order flow toxicity on Uniswap v3 is that the platform is not always friendly to large non-arbitrage traders. This may sound surprising because Uniswap v3 has attracted significant liquidity and is competitive in terms of price-impact costs to centralized exchanges. Moreover, large volume traders may not be sensitive to the blockchain-specific costs, such as gas fees. To unravel the puzzle of order flow toxicity, we need to take an in-depth look at the execution strategies for large orders in traditional and decentralized finance.

In this first post of the series, we start by reviewing some basic market microstructure theory, as well as the strategies employed by large retail and institutional investors on centralized exchanges.

A little bit of background

With features such as concentrated liquidity and flexible fee tiers, Uniswap v3 has been a major improvement over the earlier decentralized exchange protocols. Yet problems with this platform are also increasingly pointed out. The order flow on Uniswap v3 is dominated by informed arbitrageurs who trade on the platform only when it offers inefficient prices. In designing their trades, arbitrageurs make sure that they are profitable net of all fees and transaction costs. Therefore they leave liquidity providers (LPs) on the wrong side of each trade. LPs, on average, make losses on the swaps initiated by arbitrageurs even after accounting for the earned fees. Several studies have shown that, as a result, majority of LPs make negative or virtually zero net returns when they provide liquidity to Uniswap v3: see, for instance, this one by CrocSwap or the one by Loesch et al. (Both of these studies were performed before the Crypto Winter of 2022, so the returns they describe could actually be optimistic relative to the recent events.)

In principle, to fight order flow toxicity, one can either make the arbitrage trading more costly or attract more of the regular, uninformed, trading volume. In these posts, we focus on this latter strategy. Why does not Uniswap v3 attract a higher uninformed flow given that it has deep liquidity in the main token pairs?

The answer might appear obvious for small uninformed trades. In addition to swap fees, traders on Ethereum L1 have to pay a gas fee for every transaction, which, depending on network congestion and ETH price, can vary anywhere from $10 to $100. The gas fee largely prevents Uniswap v3 from being cost-competitive with centralized exchanges in the small trade segment. Yet these days, small transactions constitute a very large and important share of the trading volume in many markets. The reason is that they are not only important in their own right, but also, as we will see below, often result from the execution of large uninformed trades. Furthermore, trade size is the single most important indicator of informed trading: arbitrageurs, on average, initiate larger trades.

Let us, however, set aside the issue of gas fees for the time being. First, it will be hopefully addressed in the near future by different blockchain scaling technologies. Second, even with high gas fees, solutions are being developed to minimize order placement costs, such as TWAMM by Paradigm. So let’s say that traders can place orders cheaply. Can a decentralized exchange protocol be competitive with centralized exchanges for large non-arbitrage trades? To address this question in detail, we first need to discuss how such trades are usually executed in traditional finance.

Strategies for large order execution in traditional finance

At the time of this writing, the order book on Binance for the ETH/USDT pair (best 100 bids and asks) looks as follows.

Order book for the ETH/USDT pair.
Figure 1. The ETH/USDT order book on Binance.

In this figure, each limit order is represented by a dot located at the corresponding price/quantity point. The best bid is at 1234.59 and the best ask is at 1234.60, with a bid-ask spread of 0.01 USDT. The bars represent the total quantity of ETH available for purchase/sale in each price range. For instance, the leftmost red bar tells us that there is slightly more than 200 ETH (207.73 to be exact) available for purchase between the prices of USDT 1234.6 and USDT 1235.1 per ETH.

Let’s say Alice needs to buy 800 ETH. This is approximately the amount of Ether available in the first four red bars. If Alice were to just place a market order for that amount, then the execution against the order book above would result in an average price of USDT 1235.5 per ETH, which is 7 basis points (0.07%) above the current mid-price of 1234.6.

Such execution with a simple market order is costly. The reason for this is that a large market order ends up “walking up the book”: while the ETH in the first red bar are purchased at an average price of USDT 1234.75, the price get progressively higher for the future units. This is why most (non-arbitrage) traders would not normally follow the naïve execution strategy described above. Instead, they would use one of the following two alternatives or some combination of thereof.

Option 1: Splitting an order into multiple market orders

One alternative to walking through the book is to split a large market order into several smaller ones and slowly feed them to the market. This strategy is so common that many brokers and exchanges offer its prepackaged implementation in the form of TWAP (time-weighted average price) or VWAP (volume-weighted average price) orders.

In our example, instead of buying ETH 800 right away, Alice could start by placing a market order for ETH 200, i.e., take the first red bar in Figure 1. (In practice, the orders are usually split into much smaller chunks.) This order will be executed at an average price of USDT 1234.75, a premium of approximately 1 basis point over the mid-price. Once the order is executed, the order book will look like in Figure 2 below. Note that the bid-ask spread is now USDT 0.06.

Figure 2. The ETH/USDT order book after Alice’s first market order.

What should we expect to happen next? As new limit orders hit the market, the order book will refill, and the spread will likely return to USDT 0.01. Moreover, if Alice’s order was indeed uninformed and did not reflect a larger market sentiment, then her price impact will be transitory and short-lasting. The mid-price will return to the neighborhood of USDT 1234.6 and Alice will be able to submit another small market order on similar terms as her original one. This would keep her the overall execution cost close to 1 bps (vs 7 bps for an immediate large market order).

The speed with which the order book replenishes and the mid-price recovers after an uninformed trade is referred to as market resilience. Market liquidity and resilience are the two major determinants of execution costs. Order books on large centralized exchanges are usually very resilient and replenish in milliseconds. One of the reasons for this is that the visible part of the order book (which we plotted in Figures 1 and 2) often reflects only a fraction of the available liquidity. This is because many exchanges (including Binance) offer liquidity providers an option to place iceberg orders that are only revealed in the order book gradually over time.

According to this study from Paradigm, Uniswap v3 has a lot liquidity. And this brings us to the main question: Just how resilient is the liquidity on Uniswap v3? Exploring this question is critical for understanding how attractive the platform is for large uninformed trades. This will be the main topic of our next article — stay tuned!

Option 2: Executing a large order with multiple limit orders

The second alternative to walking through the book is to execute a large order as a sequence of smaller limit orders. For example, Alice could submit a buy limit order for ETH 200 at USDT 1234.35. This would lead to the following order book, where Alice’s new liquidity is shown in the darker green color.

Figure 3. The ETH/USDT order book with Alice’s first limit order.

In the best-case scenario, her limit order would be quickly executed against an uninformed market sell order. In that case, she would end up purchasing ETH below the current market price, saving 2 bps relative to the mid-price. However, the timing and nature of the execution of limit orders is uncertain, which leads to two potential risks for this strategy. First, the price of Ether can go up, leaving Alice’s order unfilled. She will then have lost the opportunity of buying Ether at a relatively advantageous price. This is known as the non-execution risk. Second, the price of Ether can suddenly go down and an arbitrageur might be able to submit a market sell order before Alice gets to cancel her buy limit order. In that case, she will end up purchasing Ether at a stale price that is too high relative to the new mid-price. This is usually referred to as the pick-off risk.

To minimize both the non-execution and pick-off risks, Alice can monitor her limit orders closely and reprice them quickly as the market price fluctuates. While this strategy is very common on centralized exchanges, it would be difficult to implement on Ethereum L1: gas fees for unfilled orders would quickly exceed the improvement in the execution cost. Besides, we do not yet have a fully decentralized protocol on the Ethereum network offering the opportunity to place true limit orders with a sufficiently small tick size. Still, some LPs on Uniswap v3 appear to provide liquidity only for short periods of time and in very narrow ranges — seemingly imitating limit orders. In our third article, we will discuss the risks and benefits of this approach for the execution of large uninformed trades on Uniswap v3.

Summary and conclusion

Taking into account the impermanent loss, Uniswap LPs generate relatively low net returns. This is because much of the trading activity on the platform is initiated by arbitrageurs who leave the LPs on the wrong side of each swap. To analyze this problem and its potential solutions, we need to look at how attractive Uniswap v3 is to regular (non-arbitrage) traders with large volumes.

In centralized exchanges, regular traders usually employ one of the two strategies to execute large traders: they break them down into a sequence of smaller market or limit orders. The first approach works well when there is sufficient liquidity in the market, and, crucially, when this liquidity is resilient, that is, replenishes quickly after an uninformed swap. The execution with limit orders can result in more advantageous prices but gives rise to the non-execution and pick-off risks.

In our next two articles, we will discuss whether these two (or similar) strategies can be successfully executed on Uniswap v3.

Acknowledgements

We thank Dmitry Livdan of Berkeley-Haas for many comments and suggestions on this and the follow-up articles. We are grateful to Louis Tiao’s for a helpful post on the Binance API.

Next part

Next series: Designing a low-toxicity AMM

--

--

Alexander Nezlobin

I am a professor at the London School of Economics, and I write about DeFi.