Logo

Coding preview

Optimal Order Book Spread Estimator

What this preview is

About this preview

Optimal Order Book Spread Estimator is a medium quant coding problem on probability in Python, asked at Quant.

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.

What this order-book statistics coding problem tests

This is a medium-difficulty Python coding problem that combines real-world market microstructure with statistical computation. It appears frequently in interviews at trading firms because it mirrors a concrete task market makers face: deciding whether a quoted spread is wide enough to risk capital on, given recent price volatility.

The problem requires you to maintain a rolling window of trade prices, compute population standard deviation correctly, and then evaluate multiple quotes against a statistical threshold. Beyond correctness, interviewers watch for how you structure the code—whether you compute the rolling statistic once per window update or redundantly per quote, and how you handle edge cases like zero volatility or insufficient data.

  • Rolling-window statistics and efficient recalculation
  • Population vs. sample standard deviation
  • Normalization and z-score interpretation in finance
  • Handling boundary conditions and numerical stability