Batcher - Moving to Pro-Rata Execution

By Jason Ridgway-Taylor

As part of the road to mainnet changes that Marigold is working on for Batcher, the first is moving the order execution from FIFO (first in, first out) to Pro-Rata. This post describes the reasoning and benefits of such a change.

What is FIFO order execution?

FIFO is a type of order execution where the priority of execution is given to those orders that were placed earlier in a given set of orders. This means that the chance of being filled is better if the order was placed earlier. For Batcher, this meant that the order most likely to be filled (price level selection not withstanding) would be the order that opened the batch or those that were placed closer to the batch opening.

What is Pro-Rata order execution?

Instead of matching orders, one-by-one, we can consider all of the orders on a particular side for a given price and treat them all fairly at the same time rather than give time preference to any one. In practice this means understanding the percentage each order contributes to the volume and then fill them accordingly. For example, if a single order is 10% of the buy side volume then he would receive 10% of any matched sell volume in exchange, with any remaining part of the order returned; i.e. a partial fill. The advantages of pro-rata execution are that all matching orders achieve a fairer fill regardless of when the order was placed in the batch.

An illustrative example

The following example, whilst contrived, will hopefully give an intuitive feel for the difference between FIFO and Pro-Rata.

The Order Book

For both illustrations, we will use the same initial order book.

Number / Wallet Side Sell Buy Amount Price
1 BUY tzBTC USDT 0.1 B Price / W Fill
2 SELL USDT tzBTC 2000 W Price / B Fill
3 BUY tzBTC USDT 0.1 W Price / B Fill
4 BUY tzBTC USDT 0.2 Oracle
5 SELL USDT tzBTC 10000 B Price / W Fill
6 SELL USDT tzBTC 2000 Oracle
7 BUY tzBTC USDT 0.1 W Price / B Fill

Additionally in both cases the clearing price (i.e. the price level at which the most orders can be cleared) will be the same; the Oracle price.

If you want to know more about Pro-Rata and Batcher, please read our blogpost on Marigold website :point_right: Batcher - Moving to Pro-Rata Execution

1 Like