Order Matching Algos

Last section included facts and figures about speed of execution. Everyone wants to be as quick as possible to either trade or place an order. This section describes WHY?

There are two basic types of order matching engines that the exchanges use to match the incoming orders.

a.      FIFO/Time Priority/Price-Time

Allocation:

Full order allocation offered to the oldest (priority) order at the best bid/offer.

Priority:

Explicit outright and strategy orders

Priority is given to the oldest explicit outright & strategy order at the best bid/offer.

Implied outright and strategy orders

Explicit orders have priority over implied orders.  Among implied orders, priority is granted to the order with the oldest constituent parent order.

The need for speed is because every trader wants to be the first one to get the orders filled. They do not want to wait in the order queue. The second they get a fill, they hedge it/try placing the profit order using smart order routing algorithms.

Equity markets are all FIFO based and most Futures contract follows FIFO for matching the orders.

b.     Pro Rata

This is the most famous and widely used order matching algorithm.

The objective of the pro-rata algorithms is to divide incoming Order between the orders at the same price level, with the volume of the orders allocated to each order being in proportion to the amount of volume they have in the market at that price i.e. –it’s a  pure Ratio based algorithm.

There are several variations of the pro-rata algorithm used by some specific products.

·         ‘vanilla’ Pro-rata;

·         Pro-rata with priority order allocation and no volume cap or minimum volume;

·         Pro-rata with priority order allocation and a volume cap;

·         Pro-rata with priority order allocation and minimum volume requirement;

·         Pro-rata with a priority order allocation, a volume cap and minimum volume requirement.

c.      Time Pro Rata

Where

N - Total number of resting buy (sell) orders sorted by time, n = 1(oldest) to N (newest)
n - Individual order being considered
r - Ascending sequence, 1 to N
An - Allocation for resting buy (sell) order, n
vn - Volume of resting order being considered, n
fn - ‘Time Pro Rata Factor’ calculated for resting buy (sell) order being considered, n
L - Incoming sell (buy) order volume

• Fractional allocations are rounded down to the nearest integer for all allocations greater than 1 and rounded up to 1 for all fractional allocations less than 1. For equally-sized fractional allocations, priority is granted to the oldest order.
• If any volume remains unallocated following this sequence (for instance, as a result of rounding, or when the calculated allocation for an order is constrained by the MIN function above), then a further pass of the sequence will occur.

Order Matching Visually Explained...

FIFO

Vanilla Pro-Rata

For an animated (video file) version explaining these algorithms watch the following video[1]

Order Matching Algorithms

[1] Order Matching explained by Rajeev Ranjan at http://www.youtube.com/watch?v=7X37kr0IRTU