LibraryInterview questions
An instrument has a tick of and a spread that is one tick wide almost all session. Right now the book at the touch is
Model each queue's remaining lifetime as exponential with a mean proportional to its size, independently of the other: and . Whichever queue clears first, it clears because trades went off at that price, and the touch then moves one tick in that direction.
We rest one lot at the front of each queue.
Ask which queue is closer to running out, and what the touch does when it goes. A quote is only worth what it earns on the fills it actually gets.
Under memoryless queue lifetimes the probability the touch moves up is the bid's share of the resting size, so the size-weighted mid crosses the weights: heavy bid, fair value near the ask. The side that fills is then the side we priced worst.
1. Which queue clears first.
For independent exponentials the smaller mean wins in proportion to its rate:
Note which size ends up on top. The bid size sets the probability the price goes up, because a thin ask is a thin ask whatever is standing behind the bid. The picture of a heavy bid "supporting" the price has the causality backwards: the heavy side is the side that is not about to be eaten.
The next transaction happens at if the ask clears and at if the bid does, so
The arithmetic mid is . Fair value sits four tenths of a tick above it, and the weighting is crossed: bid size multiplies ask price. This quantity is usually called a weighted mid or a micro-price.
2. What the quotes are worth.
Mark each side against rather than against the mid:
Against the mid both would have read half a tick. Now weight by whether that side actually trades. Our bid fills when the bid queue clears, probability ; our ask fills when the ask queue clears, probability . Per touch event exactly one of them fills, so
Marking to the mid said half a tick. Marking to fair value says . Sixty four percent of the apparent edge was an artifact of the reference price, and no trading decision caused it.
Worth seeing the general shape: peaks at and falls to zero at either extreme. A symmetric two-sided quote on a perfectly one-sided book earns nothing at all here. That is stronger than "earns less": one of the two quotes is certain to be the wrong one, so there is no service left to be paid for.
3. What it leaves us holding.
Per touch event we buy one lot with probability and sell one with probability :
We get short at four fifths of a lot per event, reliably, because the side that fills is the side the market is running through. This is the real cost of quoting symmetrically into an imbalanced book, and note its character: it is a directional inventory, not a noisy one. Widening both quotes does nothing to it. Only repricing or pulling a side does.
Two unlike quantities share one axis, ticks and lots, because the point is where each one peaks rather than their levels.
4. The trap.
The tempting answer is yes, show the bid, its edge is nine times the ask's. Compute both.
Identical, and each exactly half of the two-sided figure. The fat edge sits on the side that rarely fills and the thin edge on the side that nearly always does, and the product is the same either way. Expected edge cannot tell these two apart.
What tells them apart is part 3. Showing only the ask gets us short at lots per event. Showing only the bid gets us long at . Same expected edge, very different positions, so the answer to "which side" is an inventory answer and never an edge answer. If we are flat and neutral, the bid is the side to show; if we are already long, the ask earns the same and takes the position off.
The lifetime assumption is the whole model. Real queues do not deplete at a rate independent of their own size, and the two sides are not independent. Modelling the book as coupled birth-death queues and computing these probabilities exactly gives conditional probabilities that are not a linear function of the imbalance ratio, and it produces non-monotonicities the linear form cannot represent Cont et al. (2010). Linear imbalance is a decent first-order device and a bad extrapolation, and it is least reliable exactly where it looks most decisive, at the extremes.
is a one-step-ahead expectation, not a fair value. It answers what the next trade prints at. It says nothing about the level after that, because the queues behind the touch were never modelled, so it is not something to iterate and not a martingale substitute for the mid.
Resting size is not order flow. The imbalance here is a snapshot of what is standing. The related flow quantity, the net of arrivals, cancellations and trades over an interval, is what relates linearly to the price change with a slope scaling as one over depth Cont et al. (2014). They are correlated and they are not the same measurement.
Displayed size is not resting size. Hidden and iceberg orders mean and are estimates. And nine hundred lots in one order behaves nothing like nine hundred one-lot orders, because cancellations scale with the number of resting orders rather than with the size.
The extended treatment, including what this does to a quoting model that assumed the mid, is in The mid is the wrong reference price.
The touch moves up with probability 0.9, so the expected next trade price is 100.009, four tenths of a tick above the arithmetic mid. A symmetric two-sided quote earns 2p(1-p), here 0.18 ticks per fill against the half tick the mid implies, and it accumulates a short position at 0.8 lots per touch event.
Thuztra Learn teaches the maths of quant finance from zero, in short lessons, for readers who are unsure of it. Three questions in the app build your quant roadmap, free. Membership is a paid subscription. See what Thuztra Learn is and what it costs, or see the whole Core quant curriculum.
Get the app and answer the three questions:
Download on the Microsoft Store Download for Android