-
Notifications
You must be signed in to change notification settings - Fork 29
Introduction
Many of the world's major financial markets use a style of auction known as the Continuous Double Auction, or CDA for short. In the CDA, a buyer or seller can announce a bid or offer at any time. At the same time, any seller can accept any buyer's bid at any time and vice versa. It’s a continuous asynchronous process that uses a limit order book (LOB) as a way of recording the bids and offers that have been made.
The CDA is particularly interesting in that, even with a small number of traders, transaction prices quickly reach the theoretical market equilibrium price. Note also that trillions of dollars flow through CDA-based markets in equities, commodities, foreign exchange, fixed income, and derivatives contracts. In almost all of these major markets, the traders engage with one another remotely, via a screen-based electronic market, placing quotes for specific quantities at specific prices on a LOB.
The LOB displays data that describes all the outstanding bids and offers, i.e. the orders that have not yet either been traded or cancelled by the traders that originated them. Offers are also referred to as asks, and the LOB has two sides: the bid book and the ask book. The bid book shows the prices of outstanding bid orders, and the quantity available at each of those prices, in descending order, so that the best (highest) bid is at the top of the book. The ask book shows the prices of outstanding asks, and the quantity available at each of those prices, in ascending order, so that the best (lowest) ask is at the top of the book.
For example:
The figure above depicts a LOB with 4 orders: 2 asks and 2 bids. There are two traders hoping to buy 5 and 3 shares in company xyz for no more than $99 and $98 per share respectively. At the same time there are two traders hoping to sell 7 and 2 shares in company xyz for no less than $101 and $103 per share respectively. Traders would speak of XYZ being priced at "99-101".
The information shown on a LOB is sometimes referred to as "level 2" or "market depth" data. In contrast, "Level 1" data just shows the price and size (quantity) for the best bid and ask, along with the price and size of the last recorded transaction. Given that level 2 data is what professional market traders use, that’s what we use in JavaLOB.