Sub topic 1
How Order Books Work
Prerequisites
This chapter assumes you know what a crypto exchange is, can hold funds on one, and can work with percentages. You should also understand that a trading pair such as BTC/USDT has a base asset (BTC) and a quote currency (USDT).
How order books work
An order book is a live list of buy and sell orders for one market, grouped by price. Buy orders are called bids. Sell orders are called asks. The highest bid and the lowest ask form the top of the book. The difference between them is the spread.
A matching engine pairs each new order with the best resting order on the other side. The trade executes at the price of the resting order.
Order types, makers and takers, and fees
A limit order rests in the book at a price you choose. A market order executes immediately against the best available prices.
A maker adds liquidity by placing an order that does not match right away. A taker removes liquidity by matching an order already in the book. Exchanges often charge takers more than makers. Fees are usually quoted in basis points, where one basis point is 0.01%.
| Role | Example fee | Fee on a 10,000 USD trade |
|---|---|---|
| Maker | 0.02% | 2.00 USD |
| Taker | 0.05% | 5.00 USD |
Liquidity, depth, and slippage
Liquidity is how easily a given size can trade near the current price. Depth is the total size resting in the book at each price level. Slippage is the gap between the expected price and the average fill price.
Suppose the asks are 0.5 BTC at 60,000 USD and 1 BTC at 60,100 USD. A market buy of 1 BTC fills 0.5 at 60,000 and 0.5 at 60,100. The average fill is 60,050 USD. Slippage is 50 USD, about 0.08% of the top-of-book price.
Spot markets
A spot market settles right away. The buyer pays the quote currency and receives the base asset, and ownership transfers at the moment of the trade. An order book for BTC/USDT on a spot venue works this way.
Why derivatives exist
A derivative is a contract whose value follows an underlying asset without transferring that asset. Traders use derivatives to gain exposure with leverage, to hedge existing holdings, or to take a view on price direction without holding coins. Futures are one type of derivative, and they settle on a set date.
Dated futures
A dated future is an agreement to trade an asset at a fixed expiry date, at a price agreed today. Its price usually differs from the spot price, and the two prices move toward each other as expiry approaches.
Exercise
The asks are 1 unit at 100 and 2 units at 101. What is the average fill price of a market buy for 2 units, and what is the slippage relative to 100?
Show answer
The buy fills 1 unit at 100 and 1 unit at 101, so the average is 100.5. Slippage is 0.5, or 0.5%.