Quantitative Finance · Book 1 · Markets

Markets I: The Ecosystem and Exchange-Traded Markets

Markets I: The Ecosystem and Exchange-Traded Markets · Markets

13Auctions

At ten minutes to four in New York the order book of a large stock looks as it has all day: a few hundred shares at each price, a cent apart. Beside it, invisible on the ordinary screen, orders to buy and sell several million shares have accumulated with a single instruction: at the closing price, whatever it is. At four o’clock they will all trade, at one price, in one instant, in a quantity the continuous market could not have absorbed in an hour. That price will value every fund holding the stock, settle the options that expire today and become the reference for tomorrow’s limits. It is computed by an algorithm of about thirty lines. This chapter is that algorithm, the information published while it waits, and the reasons one print a day has become the most important one.

13.1 The call auction

Definition 13.1 (Call auction and uncrossing price)

In a call auction orders are collected for a period without being executed; at the end of it a single uncrossing price is computed, and every order that can trade at that price does, at that price. Opening and closing auctions, volatility interruptions and initial public offerings are call auctions; so, in miniature, are the periodic auctions of Definition 11.9.

For a candidate price pp write D(p)D(p) for the total quantity of buy orders willing to pay pp or more (market orders included) and S(p)S(p) for the total quantity of sell orders willing to accept pp or less. DD is decreasing, SS increasing; the quantity that can trade at pp is min⁡(D(p),S(p))\min(D(p), S(p)).

Method 13.2 (The uncrossing rules)

Among the limit prices present in the book and the reference price:

  1. Volume. Keep the prices that maximise the executable volume min⁡(D(p),S(p))\min(D(p),S(p)).
  2. Surplus. Among those, keep the prices that minimise the unexecuted quantity ∣D(p)−S(p)∣|D(p) - S(p)|.
  3. Market pressure. If at every remaining price the surplus is on the buy side, take the highest; if on the sell side, the lowest.
  4. Reference price. Otherwise take the price closest to the reference price (usually the last traded price).

Then allocate: market orders first, then limit orders priced better than the uncrossing price, then orders at the uncrossing price in time priority, until the executable volume is exhausted on each side.

The first two rules are common to the European exchanges’ published market models: the auction price is the one “with the most executable volume and the lowest surplus”. The tie-breaking rules vary in detail from venue to venue, and an implementation must follow the rulebook of the venue it simulates; the logic above is the usual one.

Example 13.3 (Eight orders)

Buyers: 300 at market; 500 at 10.03; 400 at 10.01; 600 at 10.00. Sellers: 200 at market; 400 at 9.99; 500 at 10.01; 700 at 10.02. The reference price is 10.00.

PriceD(p)D(p)S(p)S(p)ExecutableSurplus
9.991 800600600+1 200+1\,200
10.001 800600600+1 200+1\,200
10.011 2001 1001 100+100+100
10.028001 800800−1 000-1\,000
10.038001 800800−1 000-1\,000

Rule 1 alone selects 10.01: 1 100 shares trade. On the buy side the market order (300) and the order at 10.03 (500) are filled in full and the order at 10.01 receives 300 of its 400; on the sell side everything up to 10.01 is filled. A buy surplus of 100 shares remains at 10.01, and that is what the exchange publishes as the closing imbalance.

Demand and supply of . The curves are step functions of the price; the auction trades the largest quantity on which they can agree, 1 100 shares at 10.01 (circled: the lower of the two curves is highest there). Data: the chapter’s example book.
Figure 13.1. Demand and supply of Example 13.3. The curves are step functions of the price; the auction trades the largest quantity on which they can agree, 1 100 shares at 10.01 (circled: the lower of the two curves is highest there). Data: the chapter’s example book.

Proposition 13.4 (Why a single price)

Among all sets of trades between the orders in the book that respect each order’s limit, the uncrossing at a price satisfying rule 1 maximises the traded volume, and every participant trades at a price at least as good as its limit with no participant able to complain that a worse-priced order traded in its place.

Proof. Any feasible set of trades at arbitrary prices pairs a buyer with limit bb and a seller with limit s≤bs \le b. Order buyers by decreasing limit and sellers by increasing limit: the kk-th pair is feasible iff the kk-th best bid is at least the kk-th best offer, and the largest such kk (in shares) is max⁡pmin⁡(D(p),S(p))\max_p \min(D(p),S(p)), attained by pairing in that order. Trading all of them at one price p⋆p^\star between the marginal bid and the marginal offer respects every limit, and any excluded order has a limit no better than an included one. ∎

13.2 Opening, closing and everything else

Definition 13.5 (Closing price, market-on-close and limit-on-close orders)

The closing price of a security is the price of its closing auction on its listing exchange. A market-on-close order (MOC) executes in that auction at whatever price it sets; a limit-on-close order (LOC) executes in it only at its limit or better.

Definition 13.6 (Order imbalance and indicative price)

During the call period the exchange publishes the indicative price, the price at which the auction would uncross if it ended now, the quantity paired at that price, and the order imbalance: the side and size of the quantity that could not be paired.

As of September 2026 — The last ten minutes in New York

On the New York Stock Exchange, MOC and LOC orders may be entered until 15:50; at that time the exchange publishes a regulatory imbalance for every symbol whose imbalance is at least 500 round lots, after which closing orders are accepted only on the opposite side, and imbalance information is republished every second. On Nasdaq, imbalance information is disseminated from 15:50, every five seconds and then every second from 15:55; MOC orders are accepted until 15:55 and LOC orders until 15:58. Both auctions run at 16:00.

The closing ten minutes on the two US listing exchanges, from . The cut-offs exist so that the published imbalance means something: after an exchange’s cut-off, new closing orders there can only reduce it.
Figure 13.2. The closing ten minutes on the two US listing exchanges, from Box 13.1. The cut-offs exist so that the published imbalance means something: after an exchange’s cut-off, new closing orders there can only reduce it.

The opening auction solves a different problem: overnight news has moved the fair price by an unknown amount and the first continuous trades would be made in the dark. A call period lets everyone see the indicative price converge before committing. It attracts far less volume than the close, because nobody is benchmarked to the open.

Definition 13.7 (Volatility interruption)

A volatility interruption is an unscheduled call auction that an exchange starts automatically when the next trade would occur outside a price corridor around a reference price: the continuous market stops for a few minutes, orders accumulate, and trading restarts at an uncrossing price.

The European exchanges’ answer to a sudden move is thus to change mechanism rather than to forbid prices, as a daily limit does (Definition 12.2), or to halt, as the American limit-up–limit-down bands do (Chapter 31).

13.3 Imbalances are information

What an unexpected closing buy order does to the price, in simulated auctions of 400 limit orders. The relation is close to linear because the supply curve near the uncrossing price is; its slope is the auction’s depth. Data: the tutorial’s simulation, 60 books per point.
Figure 13.3. What an unexpected closing buy order does to the price, in simulated auctions of 400 limit orders. The relation is close to linear because the supply curve near the uncrossing price is; its slope is the auction’s depth. Data: the tutorial’s simulation, 60 books per point.

Proposition 13.8 (The price of an imbalance)

Suppose that near the uncrossing price the book has a constant density: each tick of price adds λS\lambda_S shares of supply and removes λD\lambda_D shares of demand. A market buy order of qq shares added to a balanced auction raises the uncrossing price by approximately q/(λD+λS)q/(\lambda_D + \lambda_S) ticks.

Proof. At the old price p0p_0, D=SD = S. At p0+xp_0 + x the new demand is D−λDx+qD - \lambda_D x + q and the supply S+λSxS + \lambda_S x; they are equal at x=q/(λD+λS)x = q/(\lambda_D + \lambda_S). ∎

The denominator is the only thing that protects a closing price from a large order, and it is endogenous: it consists of participants who watch the published imbalance and enter offsetting interest because they expect the imbalance to move the price. Liquidity providers in the close are paid by the difference between the closing price and the price a few minutes before or the next morning; index funds pay it, knowingly, as the price of zero tracking error (Chapter 15). An order designed to move the close rather than to trade — “marking the close” — is market manipulation everywhere, and the closing auction’s transparency is what makes it detectable.

13.4 Why the close keeps growing

Three forces push volume toward the closing auction, and each reinforces the others. Benchmarks: index funds, and every manager measured against an index, are valued at closing prices; trading at any other price is a tracking-error risk taken for no reward (Chapter 3). Size: the auction offers the day’s deepest liquidity at zero spread, so large orders that are indifferent to timing prefer it; their presence makes it deeper still. Thinning elsewhere: volume that moves to the close leaves the continuous session shallower, which raises the cost of trading intraday and sends more orders to the close. In Europe a quarter of on-exchange turnover now trades in closing auctions (Box 11.2). The listing exchange owns this auction, and with it one of the last pieces of pricing power in equity trading.

13.5 Tutorial: uncrossing a book

Goal. Implement the uncrossing rules, reproduce Example 13.3, then watch an indicative price converge. End state: price 10.01, volume 1 100, surplus +100+100, and the two charts of this section.

  1. The four rules, on integer prices in ticks.

    def uncross(orders: list[AuctionOrder], reference: int) -> Uncrossing:
        prices = sorted({o.price for o in orders if o.price is not None} | {reference})
        table = [(p, demand(orders, p), supply(orders, p)) for p in prices]
        best = max(min(d, s) for _, d, s in table)
        if best == 0:
            return Uncrossing(None, 0, 0, ())
        cands = [(p, d, s) for p, d, s in table if min(d, s) == best]                 # rule 1
        least = min(abs(d - s) for _, d, s in cands)
        cands = [c for c in cands if abs(c[1] - c[2]) == least]                       # rule 2
        if all(d > s for _, d, s in cands):
            p, d, s = cands[-1]                                                       # rule 3: buy pressure
        elif all(d < s for _, d, s in cands):
            p, d, s = cands[0]                                                        # rule 3: sell pressure
        else:
            p, d, s = min(cands, key=lambda c: (abs(c[0] - reference), c[0]))         # rule 4
        return Uncrossing(p, best, d - s, tuple(_allocate(orders, p, best)))
    Listing 13.1. Uncrossing: volume, surplus, market pressure, reference price. code/firm/auction/firm_auction.py
  2. Allocation. Sort each side so that market orders come first, then better prices, then earlier arrival, and fill until the volume is exhausted.

    def _allocate(orders, p: int, volume: int):
        """Market orders first, then better-priced limits, then time priority."""
        fills = []
        for side in (+1, -1):
            eligible = [o for o in orders if o.side == side and
                        (o.price is None or (o.price >= p if side > 0 else o.price <= p))]
            eligible.sort(key=lambda o: (o.price is not None, -side * (o.price or 0), o.seq))
            left = volume
            for o in eligible:
                q = min(left, o.quantity)
                if q:
                    fills.append((o.order_id, q))
                left -= q
        return fills
    Listing 13.2. Allocation with price and time priority. code/firm/auction/firm_auction.py
  3. Run the example; the acceptance tests also cover an empty cross, one-sided pressure, a balanced tie broken by the reference price, and time priority at the uncrossing price.
  4. A call phase. Feed 600 random orders in forty batches and recompute after each: the indicative price wanders by two or three ticks at first and settles as the paired volume grows.

What to change next. Add a rule that the uncrossing price must lie within a collar of the last continuous trade, and extend the call if it does not — a volatility interruption inside the auction. Then add imbalance-only orders, which may trade only against the surplus.

A simulated call phase. The indicative price (blue, left axis) moves freely while little is paired and is pinned once the paired volume (red dashed, right axis) is large compared with any single order. Data: the tutorial’s simulation.
Figure 13.4. A simulated call phase. The indicative price (blue, left axis) moves freely while little is paired and is pinned once the paired volume (red dashed, right axis) is large compared with any single order. Data: the tutorial’s simulation.

13.6 Build: the auction

Purpose. The exchange simulator of One Quant Book 10 opens and closes each session with a call auction and interrupts continuous trading with one when prices move too fast. This is its uncrossing engine.

Interface. AuctionOrder(order_id, side, quantity, price, seq) with price = None for a market order; uncross(orders, reference) returning price, volume, signed surplus and the list of fills; demand and supply for publishing indicative information.

Rules. Integer prices. The four rules of Method 13.2 in that order; candidate prices are the limits present in the book and the reference. No cross gives no price and no fills. Bought and sold quantities in the fills are equal, always.

Acceptance tests. code/firm/auction/tests/, cpp/ and rust/: the chapter’s example with its partial fill; no cross; buy and sell pressure; the reference-price tie-break; time priority. The three implementations must agree.

Stretch. Imbalance-only and limit-on-close order types with entry cut-offs, and a function that publishes paired quantity, imbalance and indicative price in the format of Box 13.1.

Sources and further reading

  • New York Stock Exchange, NYSE Closing Process and NYSE Opening and Closing Auctions fact sheets; NYSE Closing Auction: Timing Shifts and Marketability Trends, 18 November 2025.
  • Nasdaq, The Nasdaq Opening and Closing Crosses: Frequently Asked Questions; US Securities and Exchange Commission, Release 34-84454 (cut-off times for on-close orders).
  • Deutsche Börse, Xetra Market Model: Continuous Trading and Auction; glossary entry “Auction principle”.
  • Euronext, Trading Manual for the Cash Market.
  • A. Madhavan, “Trading mechanisms in securities markets”, Journal of Finance 47 (1992).
  • M. Pagano and R. Schwartz, “A closing call’s impact on market quality at Euronext Paris”, Journal of Financial Economics 68 (2003).

13.7 Exercises

Exercise 13.1 ★

Buy orders: 400 at 20.10, 300 at 20.05, 500 at 20.00. Sell orders: 200 at 19.95, 600 at 20.05, 300 at 20.10. Tabulate DD, SS and the executable volume at each limit price and give the uncrossing price and volume.

Solution

Solution of Exercise 13.1.

At 19.95 and 20.00: D=1 200D = 1\,200, S=200S = 200, executable 200. At 20.05: D=700D = 700, S=800S = 800, executable 700. At 20.10: D=400D = 400, S=1 100S = 1\,100, executable 400. The auction uncrosses at 20.05 for 700 shares.

Exercise 13.2 ★

For the auction of the previous exercise give the surplus and its side, and say which orders are filled, fully or partly.

Solution

Solution of Exercise 13.2.

Surplus 700−800=−100700 - 800 = -100: 100 shares remain to sell at 20.05. Both buy orders at 20.10 and 20.05 are filled in full; the sell order at 19.95 in full and the one at 20.05 for 500 of its 600. The orders at 20.00 (buy) and 20.10 (sell) do not trade.

Exercise 13.3 ★

Using Box 13.1: at 15:53 a trader wants to add a market-on-close buy order in a stock listed on each exchange. On which can she, and under what condition on the other?

Solution

Solution of Exercise 13.3.

On Nasdaq, freely: MOC entry closes at 15:55. On the New York Stock Exchange only if a regulatory sell imbalance was published at 15:50 in that symbol: after the cut-off closing orders are accepted only on the side that offsets the published imbalance.

Exercise 13.4 ★★

A book has a single buy order, 1 000 shares at 50.20, and a single sell order, 1 000 shares at 50.00. The reference price is 50.12. Apply the four rules. What would the price be with a reference of 50.40?

Solution

Solution of Exercise 13.4.

Every price from 50.00 to 50.20 executes 1 000 shares with zero surplus: rules 1 to 3 do not decide. Rule 4 gives the reference price, 50.12. With a reference of 50.40, outside the range, the closest candidate is 50.20. Two parties willing to trade anywhere in a 20-cent range are priced by the last trade, not by either of them.

Exercise 13.5 ★★

Near its uncrossing price an auction has 40 000 shares of supply and 25 000 shares of demand per tick. Estimate the effect of an unexpected market-on-close purchase of 300 000 shares. The tick is 1 cent and the stock trades at $80: express it in basis points.

Solution

Solution of Exercise 13.5.

300 000/(25 000+40 000)=4.6300\,000/(25\,000 + 40\,000) = 4.6 ticks, about 5 cents, that is 4.6/8 000=5.8 bp4.6/8\,000 = 5.8\,\mathrm{bp}.

Exercise 13.6 ★★

An index fund must buy $50 million of a stock at the close. The published imbalance suggests the close will be 12 basis points above the current continuous price; buying now in the continuous market would cost an estimated 8 basis points of impact. What does each choice cost in expectation, and why will the fund still use the close?

Solution

Solution of Exercise 13.6.

At the close: 0.12%×50=$60 0000.12\% \times 50 = \$60\,000 above the current price. Now: 0.08%×50=$40 0000.08\% \times 50 = \$40\,000 of impact, plus the risk that the close differs from the price obtained, which the fund cannot justify: its benchmark is the close, and a purchase at the close has zero tracking error whatever the premium. The $20 000 is the price of that certainty, paid by the fund’s investors and invisible in its tracking statistics.

Exercise 13.7 ★★★

Coding. With imbalance_impact, estimate the slope of the closing price with respect to imbalance for books of 400 and of 1 600 orders (60 books each, imbalance 50% of the balanced volume). Compare the slopes per share of imbalance and relate them to Proposition 13.8.

Solution

Solution of Exercise 13.7.

With 400 orders an imbalance of 50% (about 45 000 shares) moves the close by 1.83 ticks: 4.1 ticks per 100 000 shares. With 1 600 orders the same 50% is about 182 000 shares and moves it 1.87 ticks: 1.0 tick per 100 000 shares. Four times as many orders means four times the density of supply and demand per tick, hence a quarter of the move per share, as Proposition 13.8 predicts; an imbalance that is a fixed fraction of the auction moves the price by the same amount in both.

Exercise 13.8 ★★★

Find the flaw. A backtest of a closing-auction strategy assumes that its limit-on-close orders, entered at the indicative price shown at 15:55, are filled in full whenever the closing price is at or through their limit. Identify two reasons the fills are overstated, and the information needed to correct them.

Solution

Solution of Exercise 13.8.

(i) At the uncrossing price orders are filled in time priority and the surplus side is only partly filled: an order entered at 15:55 at exactly the closing price is behind everyone earlier and often receives nothing. (ii) The indicative price at 15:55 is itself moved by the strategy’s order and by the offsetting interest it attracts; when the close moves through the limit, it is typically because better-informed interest arrived afterwards, so the fills obtained are adversely selected. Correcting this requires the auction’s paired and imbalance quantities at the uncrossing, the order’s position in the time queue at its limit, and an estimate of the strategy’s own impact from Proposition 13.8.

13.8 Problem: The Index Rebalance Close

Problem 13.1

Weekend problem — a closing auction on rebalance day

A stock joins an index at today’s close. Ten minutes before the close its continuous market is 39.99×40.0139.99 \times 40.01 and the last trade, the reference price, is 40.00; the tick is 1 cent. The closing book holds, besides the index funds’ order, the following.

Buy: 50 000 at market; 80 000 at 40.10; 120 000 at 40.00; 150 000 at 39.90. Sell: 60 000 at market; 100 000 at 39.95; 140 000 at 40.05; 200 000 at 40.15; 250 000 at 40.30; 300 000 at 40.50.

Part I — Without the index funds.

  1. Tabulate D(p)D(p) and S(p)S(p) at each limit price from 39.90 to 40.50.
  2. Give the executable volume at each and the uncrossing price and volume.
  3. Give the surplus and its side.
  4. Which orders are partly filled?

Part II — The index funds arrive. Index funds add a market-on-close buy order for 500 000 shares.

  1. Recompute D(p)D(p).
  2. Give the new uncrossing price and volume.
  3. By how much, in cents and in basis points, did the index order move the close?
  4. What imbalance was published at 15:50 if the index order was already in, and the uncrossing had been computed at the reference price?
  5. How many dollars did the index funds pay above the price of question 2, on their 500 000 shares?

Part III — Liquidity arrives. Seeing the imbalance, liquidity providers add sell orders: 150 000 at 40.10 and 200 000 at 40.20.

  1. Recompute S(p)S(p) and the uncrossing price and volume.
  2. How much did the offsetting orders save the index funds?
  3. A provider sold 150 000 shares at the new close and expects the stock to revert to 40.05 tomorrow. What is its expected profit?
  4. What risk is it taking overnight, and how might it hedge?
  5. Estimate the auction’s depth λD+λS\lambda_D + \lambda_S per tick around the final price from your tables, and check Proposition 13.8 on the move caused by the index order in Part III.

Part IV — Judgement.

  1. The index funds could have bought during the previous days instead. What would they have gained and what would they have risked?
  2. Who, economically, pays the liquidity providers of question 12?
  3. A trader enters a large limit-on-close buy order at 15:57 and cancels it at 15:59:50 on an exchange that allows it. What was its purpose, and what is the practice called?
  4. Why do exchanges restrict entry and cancellation of closing orders after the first imbalance publication?
  5. State the named result: the uncrossing price and the paired volume of the final auction of Part III.
  6. In one sentence: what does an index fund buy with the premium it pays at the close?
Solution

Solution of Problem 13.1.

1. DD: 400 000 at 39.90; 250 000 at 39.95 and 40.00; 130 000 at 40.05 and 40.10; 50 000 from 40.15. SS: 60 000; 160 000; 160 000; 300 000; 300 000; 500 000 at 40.15; 750 000 at 40.30; 1 050 000 at 40.50. 2. Executable: 60, 160, 160, 130, 130, 50, 50, 50 (thousands). The maximum, 160 000, occurs at 39.95 and 40.00 with the same surplus; the surplus is to buy at both, so rule 3 takes the higher: 40.00. 3. 250 000−160 000=90 000250\,000 - 160\,000 = 90\,000 to buy. 4. The buy order at 40.00 receives 30 000 of its 120 000. 5. Every value of DD rises by 500 000: 900, 750, 750, 630, 630, 550, 550, 550 (thousands). 6. Executable: 60, 160, 160, 300, 300, 500, 550, 550. The maximum 550 000 occurs at 40.30 and 40.50; the surplus is 200 000 to sell at 40.30 and 500 000 at 40.50: rule 2 gives 40.30. 7. 30 cents, 75 basis points. 8. At 40.00: 750 000−160 000=590 000750\,000 - 160\,000 = 590\,000 shares to buy. 9. 0.30×500 000=$150 0000.30 \times 500\,000 = \$150\,000. 10. SS becomes 450 000 at 40.10, 650 000 at 40.15, 850 000 at 40.20, 1 100 000 at 40.30. Executable 550 000 from 40.15 upward; the smallest surplus, 100 000 to sell, is at 40.15: the close is 40.15 for 550 000 shares. 11. 0.15×500 000=$75 0000.15 \times 500\,000 = \$75\,000. 12. It sold at 40.15 and expects to buy back at 40.05: 0.10×150 000=$15 0000.10 \times 150\,000 = \$15\,000. 13. It is short 150 000 shares overnight in a stock that has just entered an index: $6 million of single-name risk, including any news. It can hedge the market component with index futures, or have bought the shares beforehand, during the days between announcement and inclusion — in which case its sale at the close completes an inventory trade. 14. Between 40.00 and 40.15 supply rises by 490 000 and demand falls by 200 000: about 46 000 shares per tick. The proposition predicts 500 000/46 000=10.9500\,000/46\,000 = 10.9 ticks against the 15 observed: the book is lumpy, and the index order exhausted the dense region near 40.00. 15. A lower average price, by anticipating their own demand; at the cost of tracking error against an index that includes the stock only from tonight’s close, and of revealing their purchases to those who trade ahead of them anyway. 16. The index funds’ investors, through a closing price 15 cents above the pre-auction market: the providers’ $15 000 is part of it, the sellers of the limit orders hit on the way up receive the rest. 17. To push the indicative price up and induce others to enter sell interest or to give up bidding, then withdraw: it never intended to trade. This is spoofing, a form of market manipulation; at the close it also marks the closing price. 18. So that the published imbalance is a credible quantity that can only shrink: late orders that could add to it, or cancellations that could resurrect it, would make the information worthless and the closing price easy to manipulate. 19. 40.15 for 550 000 shares. 20. The certainty of owning the stock at exactly the price its benchmark uses.

13.9 Interview questions

Interview question 13.1 ★ trader, developer, researcher

How is the price of a closing auction determined?

Solution

Solution of Interview question 13.1.

Orders accumulate without trading. At the close the exchange finds the price that maximises the matched volume; ties are broken by the smallest imbalance, then by the side of the imbalance, then by proximity to a reference price. All matched orders trade at that one price, with market orders and better-priced limits first and time priority at the clearing price.

What the interviewer is looking for: maximum volume first, and a sensible tie-break sequence.

Interview question 13.2 ★ trader, researcher

Why does so much volume trade at the close?

Solution

Solution of Interview question 13.2.

Index funds and benchmarked managers are valued at the close and avoid tracking error by trading there; derivatives and fund flows settle on it; the auction offers the deepest liquidity of the day at no spread; and volume that moves there thins the intraday market, pushing more volume there. Passive growth makes each of these stronger every year.

What the interviewer is looking for: benchmarking as the root cause.

Interview question 13.3 ★★ developer

Implement an uncrossing algorithm that runs in O(nlog⁡n)O(n \log n) for nn orders. What are the edge cases?

Solution

Solution of Interview question 13.3.

Sort buy limits descending and sell limits ascending, with market orders at the front of each; walk the distinct prices once with running cumulative demand and supply (two pointers), tracking the best executable volume and, among ties, the smallest surplus: O(nlog⁡n)O(n\log n) for the sorts, O(n)O(n) for the sweep. Edge cases: no cross; only market orders on both sides (no limit price: use the reference); ties over a range of prices; zero-surplus ranges; quantities that overflow 32 bits; allocation at the clearing price when the surplus side must be pro-rated or time-prioritised; self-match prevention.

What the interviewer is looking for: the single sweep with running sums, and the market-orders-only case.

Interview question 13.4 ★★ trader, researcher

The published closing imbalance in a stock is 800 000 shares to buy, against an average auction of 1.5 million. What do you expect to happen in the next ten minutes, in the auction and in the continuous market?

Solution

Solution of Interview question 13.4.

The imbalance is more than half an average auction: the indicative price will be well above the last trade. Offsetting sell interest arrives — liquidity providers, and holders with limit-on-close orders — shrinking the imbalance and pulling the indicative price back toward the market, but not all the way. The continuous price is dragged upward in the last minutes as those who sell in the auction hedge by buying now, and as others buy ahead of the close to sell into it. Expect partial reversal at the next open.

What the interviewer is looking for: both the auction dynamics and the spill-over to the continuous book.

Interview question 13.5 ★★ researcher, mle

You want to predict the closing price from imbalance messages. What is your target, what are your features, and what is the main trap in the evaluation?

Solution

Solution of Interview question 13.5.

Target: closing price minus the mid at prediction time (in basis points or spreads), or the next morning’s reversal. Features: signed imbalance scaled by average auction volume and by displayed depth, paired quantity, indicative price relative to the mid, their changes between messages, time to close, index events, volatility. Trap: the imbalance feed and the continuous quotes come with different latencies, and features built from messages published after the decision time leak the answer; evaluation must also account for the strategy’s own order changing the imbalance it conditions on.

What the interviewer is looking for: look-ahead through timestamps, and self-impact.

Interview question 13.6 ★★★ trader, researcher

A venue proposes to replace continuous trading with an auction every 100 milliseconds. Who gains, who loses, and what would you expect to happen to spreads?

Solution

Solution of Interview question 13.6.

Gains: slower liquidity providers, who can no longer be sniped within a batch interval, since all orders arriving in the same 100 milliseconds compete on price, not on time; investors, if the saving is passed on as narrower spreads. Loses: firms whose edge is pure speed; possibly the venue, if takers dislike waiting and leave for continuous competitors. Spreads should narrow where sniping costs were a large part of them and widen nowhere; but with a single venue adopting it, arbitrage between it and continuous venues reintroduces a race at each batch boundary, and the benefit depends on what share of the market moves.

What the interviewer is looking for: price competition replacing time competition, and the fragmentation caveat.

Terms defined in this chapter

See all 2333 terms in the glossary