LibraryInterview questions

Quoting Both Sides of a Lopsided Book

Quant interview question · medium · free, full solution

The question

An instrument has a tick of 0.010.01 and a spread that is one tick wide almost all session. Right now the book at the touch is

bid 100.00 for Qb=900 lots,ask 100.01 for Qa=100 lots\text{bid } 100.00 \text{ for } Q^b = 900 \text{ lots}, \qquad \text{ask } 100.01 \text{ for } Q^a = 100 \text{ lots}

Model each queue's remaining lifetime as exponential with a mean proportional to its size, independently of the other: Ta∼Exp(1/Qa)T^a \sim \mathrm{Exp}(1/Q^a) and Tb∼Exp(1/Qb)T^b \sim \mathrm{Exp}(1/Q^b). 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.

  1. What is the probability the touch moves up, and what is the expected price of the next transaction?
  2. Mark each of our two quotes against that fair value. What is the expected edge on the fill we get?
  3. What does the same quote pair do to our position?
  4. The bid edge is much larger than the ask edge. Should we show only the bid?

Hint

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.

The idea behind it

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.

Worked solution

1. Which queue clears first.

For independent exponentials the smaller mean wins in proportion to its rate:

p≡Pr⁡(Ta<Tb)=1/Qa1/Qa+1/Qb=QbQa+Qb=9001000=0.9p \equiv \Pr(T^a < T^b) = \frac{1/Q^a}{1/Q^a + 1/Q^b} = \frac{Q^b}{Q^a + Q^b} = \frac{900}{1000} = 0.9

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 100.01100.01 if the ask clears and at 100.00100.00 if the bid does, so

Mw=p Pa+(1−p) Pb=QbPa+QaPbQa+QbM^w = p \, P^a + (1-p) \, P^b = \frac{Q^b P^a + Q^a P^b}{Q^a + Q^b}
Mw=0.9×100.01+0.1×100.00=90.009+10.000=100.009M^w = 0.9 \times 100.01 + 0.1 \times 100.00 = 90.009 + 10.000 = 100.009

The arithmetic mid is 100.005100.005. 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 MwM^w rather than against the mid:

bid edge=Mw−Pb=0.009=0.9 ticks,ask edge=Pa−Mw=0.001=0.1 ticks\text{bid edge} = M^w - P^b = 0.009 = 0.9 \text{ ticks}, \qquad \text{ask edge} = P^a - M^w = 0.001 = 0.1 \text{ ticks}

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 1−p1 - p; our ask fills when the ask queue clears, probability pp. Per touch event exactly one of them fills, so

E[edge]=(1−p) p+p (1−p)=2p(1−p)=2×0.9×0.1=0.18 ticks\mathbb{E}[\text{edge}] = (1-p)\,p + p\,(1-p) = 2p(1-p) = 2 \times 0.9 \times 0.1 = 0.18 \text{ ticks}

Marking to the mid said half a tick. Marking to fair value says 0.180.18. 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: 2p(1−p)2p(1-p) peaks at p=1/2p = 1/2 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 1−p1 - p and sell one with probability pp:

E[Δq]=(1−p)(+1)+p(−1)=1−2p=−0.8 lots\mathbb{E}[\Delta q] = (1-p)(+1) + p(-1) = 1 - 2p = -0.8 \text{ lots}

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.

Line chart of Per touch event against Chance the ask clears first. Expected edge in ticks. 0: 0; 0.1: 0.18; 0.2: 0.32; 0.3: 0.42; 0.4: 0.48; 0.5: 0.5; 0.6: 0.48; 0.7: 0.42; 0.8: 0.32; 0.9: 0.18; 1: 0. Expected inventory change in lots. 0: 1; 0.1: 0.8; 0.2: 0.6; 0.3: 0.4; 0.4: 0.2; 0.5: 0; 0.6: −0.2; 0.7: −0.4; 0.8: −0.6; 0.9: −0.8; 1: −1. Reference line the book in the question at x = 0.9.Per touch event−1.0−0.50.00.51.00.00.20.40.60.81.0Chance the ask clears firstExpected edge inticksExpected inventorychange in lots0.18 ticksshort 0.8 lotsthe book in the questionLine chart of Per touch event against Chance the ask clears first. Expected edge in ticks. 0: 0; 0.1: 0.18; 0.2: 0.32; 0.3: 0.42; 0.4: 0.48; 0.5: 0.5; 0.6: 0.48; 0.7: 0.42; 0.8: 0.32; 0.9: 0.18; 1: 0. Expected inventory change in lots. 0: 1; 0.1: 0.8; 0.2: 0.6; 0.3: 0.4; 0.4: 0.2; 0.5: 0; 0.6: −0.2; 0.7: −0.4; 0.8: −0.6; 0.9: −0.8; 1: −1. Reference line the book in the question at x = 0.9.Per touch eventExpected edge in ticksExpected inventory change in lots−1.0−0.50.00.51.00.00.51.0Chance the ask clears first0.18 ticksshort 0.8 lotsthe book in the question
Expected edge is largest where the book is balanced and falls to nothing at either extreme, while the inventory the same symmetric quote picks up is largest exactly where the edge is smallest.

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.

bid only:(1−p)×p=0.1×0.9=0.09 ticks per event\text{bid only:} \quad (1-p) \times p = 0.1 \times 0.9 = 0.09 \text{ ticks per event}
ask only:p×(1−p)=0.9×0.1=0.09 ticks per event\text{ask only:} \quad p \times (1-p) = 0.9 \times 0.1 = 0.09 \text{ ticks per event}

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 0.90.9 lots per event. Showing only the bid gets us long at 0.10.1. 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.

What an interviewer is likely to push on

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.

MwM^w 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 QaQ^a and QbQ^b 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.

In short

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.

Learn quant finance on Thuztra Learn

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

On Android, the app is a direct download, not a Google Play listing. Which devices, and what each one needs.

References

  1. Cont, R., Stoikov, S., and Talreja, R. (2010) A Stochastic Model for Order Book Dynamics. Operations Research.
  2. Cont, R., Kukanov, A., and Stoikov, S. (2014) The Price Impact of Order Book Events. Journal of Financial Econometrics.

Further reading

Topics

Also in the library