So far: A five-minute candle keeps four prices and a volume, and many different runs of trades leave the same one: their sizes, their order and every step the price took are gone (lesson 4).
Past the best ask
In lesson 1 you bought one sack from the cheapest note to sell, and the next buyer paid a little more. Now buy more than the best ask holds. The rest of your order doesn't wait: it takes the next cheapest price, then the next, until it is filled. Traders call this walking the book.
Here is a deeper book, with toy numbers: a unit costs about 100 coins, and prices move one tick, 0.01, at a time. Each column is one level, as tall as the units waiting there: bids on the left, asks on the right, 25 levels of asks in all. Pick a size and send your order.
Pick an order size and send it. Watch it take the asks level by level, and see where its average price lands.
Nothing sent yet. The best ask holds 10 units at 100.00. Send 40 units and see how far up the book they reach.
An order of 40 takes all 10 units at the best ask, then 6 at 100.01, 8 at 100.02, 6 at 100.03, 8 at 100.04 and the last 2 at 100.05. Each fill is a trade of its own, at its level's price. They average 100.0205, which is 2.05 basis points over the best ask. That difference is the order's slippage.
Slippage is measured from the best price you could see when you sent the order: the best ask for a buy, the best bid for a sell. An order the best level can hold has none. Double the order to 80 units and the slippage more than doubles, to 4.48 basis points. Paid on twice as many units, the extra over the best ask comes to more than four times as much: 3.58 coins against 0.82.
The maths
An order of Q units fills q1 at p1, q2 at p2, and so on:
average price = (q1 · p1 + q2 · p2 + …) / Q
slippage of a buy, in bps = (average − best ask) / best ask × 10,000
slippage of a sell, in bps = (best bid − average) / best bid × 10,000
Thin and thick
How far an order walks depends on how much waits at each level. A book with plenty at every price is called deep, or thick, and one with little is thin. The figure sets the book from above next to one with half as much at every level. Move your order and compare.
Drag the order size. Compare what the same order pays on a thick book and on a thin one.
- Slippage, thick
- 2.05 bps
- Slippage, thin
- 4.48 bps
- Levels, thick
- 6
- Levels, thin
- 10
With half as much at every level, the same 40 units walk 10 levels instead of 6, and pay 4.48 basis points instead of 2.05: 2.2 times as much.
Halve the depth and the slippage roughly doubles. At 40 units the thin book charges 4.48 basis points against the thick book's 2.05, and the order walks 10 levels instead of 6. The thick book's line also bends: past 118 units the order reaches the wall of 40 units at 100.13, and the line flattens, because every unit in the wall costs the same.
So a trader who needs to buy a lot can split the order and send the pieces minutes apart, and each piece meets a book that has had time to refill. Whether it refills, and at what price, is the next lesson.
Which side is heavier
Lesson 2 compared the queues at the best bid and the best ask. With 25 levels a side you can ask the same question at any depth: add up the first 5 levels of each side, or 10, 20 or 25, and compare. The book imbalance is the difference over the total. It runs from −1 when only asks wait to +1 when only bids do.
Add up the first 5, 10, 20 or 25 levels on each side. Watch which side comes out heavier.
- Bids
- 60 units
- Asks
- 38 units
- Imbalance
- +0.22
- Heavier side
- bids
Near the price the bids are heavier. The next small trades meet these levels first.
In this book the answer depends on how far you look. On the first five levels the bids are heavier, 60 units against 38, an imbalance of +0.22. Across all 25 levels the asks hold twice as much, 312 against 156, an imbalance of −0.33. Both readings are right, and they answer different questions. The first levels are what the next small trades will meet. The deeper ones are what a large order would meet, and they are further from trading: whoever placed them can move or cancel them before the price gets there.
The maths
Over the first N levels of each side, with B units of bids and A units of asks:
imbalance = B − A, imbalance ratio = (B − A) / (B + A)
In real data
What you learned
- Level
- One price in the book, with everything waiting there added up.
- Walking the book
- An order bigger than the best level takes the next level, then the next, each at a worse price.
- Slippage
- How far an order's average price lands from the best quote it met, in basis points: over the best ask for a buy, under the best bid for a sell.
- Depth
- How much waits on the first 5, 10, 20 or 25 levels of a side. The thinner the book, the further an order walks.
- Book imbalance
- Bids minus asks over the same levels, divided by their sum: positive when more waits to buy. Near and far levels can lean opposite ways.
Check yourself
1. The best ask holds 10 units. You buy 8. What is your slippage?
2. Halve what waits at every level. What happens to the slippage of the same order?
3. On the first five levels, 60 units wait to buy and 40 to sell. What is the book imbalance?