DORRS Products
Depth of Book - Building an Order Book
The Price-Time priority algorithm used to build and maintain an order book.
The Price-Time priority algorithm is a fundamental rule used to build and maintain an order book in financial markets. This algorithm determines the order in which trades are executed, ensuring a fair process.
Order Book Price Priority
- The primary factor in this algorithm is the price of the orders.
- For buy orders, higher-priced orders get priority, meaning an order to buy at a higher price will be executed before orders to buy at lower prices.
- For sell orders, it's the opposite: lower-priced orders are executed first.
- This prioritization ensures that the best available prices (highest for buyers, lowest for sellers) are always the ones that get matched first in the market.
Time Priority:
- When multiple orders have the same price, the time priority rule is applied.
- Orders are ranked in the order they were entered into the system. The first order at a particular price level ranks higher than orders that come later at the same price.
Building the Order Book:
As new buy and sell orders come in, they are added to the order book according to these rules.
- Buy orders (bids) are arranged from highest to lowest price, and within the same price, from earliest to latest.
- Sell orders (asks) are arranged from lowest to highest price, and within the same price, from earliest to latest.
Depth of Book Fields
- Action — New Order, Add Order, Remove. Values: N, A, R
- Origin — the MPID of the Alternative Trading System (ATS) or market maker adding the quote.
- Symbol — the symbol for the BBO data entered.
- Quote Condition — "C" Automated Bid and Ask, "B" if manual on the bid, "A" if manual on the offer, and "H" if manual on both the bid and ask.
- MPID — the Market Participant ID that is the quote source of the price.
- Side — (Bid, Offer)
- Size — share size available at the bid price.
- Price — the bid price for the bid MPID.
- Date — the date the quote was entered, generated by the system.
- Time — time the quote was generated by the system.
- Status — the DORRS system needs to add a status field for the state of the order in the book based on the message. This field does not have to be displayed; it is used only to determine what is shown in the depth of book.
- Open: New Order and Add Order — the order is active in the market and has not yet been filled. For an Add Order: part of the order has been executed, but some quantity remains open, so an Add Order update would be received.
- Closed: Removed Order — the order has been withdrawn from the market before being filled, or the order has been completely filled.
- Reference Number ID — a unique identification. Each order in the order book is assigned a unique Reference Number ID when it is created. This Ref ID is essential for uniquely identifying each order in the system from Alternative Trading Systems, which can include thousands of orders at any given time.
- If there is an Add Order or Remove Order, see the Reference ID section to create a methodology.
- Universal Transaction ID (UTI) — unique reference number generated by DORRS for each entry as previously defined.