The Claude Quant PlaybookDownload ebookDownload ebook

Microprice (size-weighted mid)

intermediateMarket making and execution2 of 10

The microprice weights each side's price by the size on the opposite side. When the bid queue is much bigger than the ask queue, the price is more likely to tick up, so the fair value leans towards the ask.

Build a trading system with Claude.Download ebook

01The formula

the microprice: a fair-value estimate inside the spread
best bid and best ask prices
shares resting at the best bid and at the best ask
the mid price, (b + a)/2

02See it move

03Where it is used

04Why traders use it

The next price change is not a coin flip: a thin queue is likely to be eaten first. The microprice turns that into a fair price you can quote around, which matters when your whole edge is a fraction of a tick.

05Worked example

With 3,000 shares on the bid and 1,000 on the ask, the microprice is $100.0075, against a mid of $100.0050. It sits $0.0025 above the mid because 75.0% of the visible size is on the bid.

06How it is built

  1. The thinner side is more likely to be cleared first, moving the price towards it.
  2. So give the ask price a weight proportional to the bid size, and the bid price a weight proportional to the ask size.
  3. That gives .
  4. Rearranging shows it is the mid plus the half-spread times the imbalance , so it always stays between and .

07The common mistake

Swapping the weights. The bid price is weighted by the ask size, not the bid size; get it backwards and your fair value moves the wrong way, towards the side that is about to hold.

08In Python and LaTeX

b, a, Vb, Va = 100.00, 100.01, 3000, 1000
micro = (b * Va + a * Vb) / (Vb + Va)
print(round(micro, 4))  # 100.0075
p_{\text{micro}} = \frac{b\,V_a + a\,V_b}{V_b + V_a} = m + \frac{a - b}{2}\cdot\frac{V_b - V_a}{V_b + V_a}

09Where it fits

Rather not code the maths yourself? Describe your trading idea and let AI build the bot.

Build a bot with AgenKit

The worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.