Midprice averages the best bid and ask. A simple quote measure often called microprice also uses displayed sizes, weighting each price by the opposite side's size. This weighted midpoint moves toward the ask when bid size is larger and toward the bid when ask size is larger. A fitted academic microprice goes further by estimating future midpoint behavior, so always check which definition a data provider uses.
That distinction matters before comparing two price series. A weighted quote can change while the best prices stay fixed, without any trade occurring. It describes a different property of the book from a midpoint, last trade or average execution price.
Start with four fields from one market
For one instrument on one venue, record the best bid price b, best ask price a, displayed quantity at the best bid Qb, and displayed quantity at the best ask Qa. Both quantities must use compatible units and the same market scope.
For example, Binance Spot's bookTicker stream identifies best bid price and quantity with b and B, and best ask price and quantity with a and A. It also supplies the symbol and an order-book update ID. Those names belong to that specific feed; another exchange can use a different schema. See Binance's Spot WebSocket stream specification.
Use the quantities at those two prices, rather than a total across several levels or a day's trading volume. A derivative's contract count also needs a consistent interpretation. The base, quote and contract volume guide explains why quantity labels matter before putting them into a ratio.
The ordinary midpoint is:
M = (b + a) / 2
It gives equal weight to the two prices regardless of displayed size. The difference a − b is the full spread. The bid-ask spread worksheet covers that execution-cost reference; the question here is how size changes a quote reference within it.
Calculate the simple weighted midpoint
Use this convention for the quote-size-weighted midpoint:
W = (a × Qb + b × Qa) / (Qb + Qa)
The ask price receives the bid quantity's weight. The bid price receives the ask quantity's weight. This is the weighted-midpoint construction in Sasha Stoikov's original microprice notebook.
Consider a hypothetical ABC/USDT spot market with a best bid of 249.80 USDT per ABC and a best ask of 250.20. The full spread is 0.40 and the midpoint is 250.00. The table holds those prices fixed while changing only the displayed quantities.
| Hypothetical book | Bid size, ABC | Ask size, ABC | Bid share of total size | Midpoint, USDT/ABC | Weighted midpoint, USDT/ABC |
|---|---|---|---|---|---|
| Balanced | 15 | 15 | 50% | 250.00 | 250.00 |
| Larger bid queue | 24 | 6 | 80% | 250.00 | 250.12 |
| Larger ask queue | 6 | 24 | 20% | 250.00 | 249.88 |
For the larger bid queue:
W = (250.20 × 24 + 249.80 × 6) / 30
W = (6,004.80 + 1,498.80) / 30 = 250.12
The weighted reference is 0.12 USDT above the midpoint, or 0.12 / 250 × 10,000 = 4.8 basis points. It remains 0.08 below the best ask. These are arithmetic differences in a constructed quote, not measured returns or evidence of a profitable trade.
Reversing the quantities moves the reference the same distance below the midpoint: 249.88. Equal quantities return 250.00. Those three cases make useful checks when implementing the formula.
Check the weighting direction before interpreting pressure
It is easy to write a plausible-looking formula with the sign reversed. Multiplying each price by its own side's size would give (249.80 × 24 + 250.20 × 6) / 30 = 249.88 in the bid-heavy example. That calculation weights the bid more heavily and moves downward. It is a different statistic from the opposite-side construction above.
The intended interpretation is that a relatively thin ask queue may be easier to exhaust than a thick bid queue. The reference therefore leans toward the ask when displayed bid quantity dominates. That interpretation is a hypothesis about book dynamics. An 80% bid share is not, by itself, an 80% probability that the next price change will be upward.
An equivalent formula makes the sign easier to inspect. Define signed size imbalance as:
J = (Qb − Qa) / (Qb + Qa)
Then simple algebra gives:
W = M + (a − b) × J / 2
In the example, J = (24 − 6) / 30 = 0.60, so the adjustment is 0.40 × 0.60 / 2 = 0.12. A positive signed imbalance adds to the midpoint. A negative one subtracts from it.
Some sources use bid share I = Qb / (Qb + Qa) instead. Its neutral value is 0.5; signed imbalance's neutral value is zero. Confusing those conventions changes the calculation even when every input field is correct.
With positive quantities and an ordered bid and ask, W lies between the two quotes. If your simple weighted midpoint falls outside them, check the formula, signs, units and synchronized inputs. This arithmetic check does not establish that the feed is current.
The academic microprice needs a model
The two-price calculation is often labeled microprice in trading explanations. Stoikov's academic construction is more specific: it considers a limit of conditional expected midprices at successive future midpoint changes. Its fitted form adds a state-dependent adjustment to the current midpoint using imbalance and spread dynamics. The research estimates transitions between book states; the adjustment is not obtained just by inserting four current fields into the weighted-midpoint formula. See Stoikov's microprice definition and estimation presentation.
Keep an arithmetic weighted midpoint and a calibrated estimate separately labeled in a dataset. For the latter, retain its fitting period, state definition and model version. A smooth-looking number does not tell you which calculation produced it.
The presentation's empirical examples use Bank of America and Chevron equity quotes from March 2011. They do not establish forecasting accuracy for a crypto pair today. Any proposed crypto model needs evidence from its own venue, instrument, feed and evaluation period.
A quote reference is not an execution price
In the hypothetical larger-bid book, a small immediate purchase still faces the displayed ask of 250.20, assuming that quantity remains available. The weighted reference of 250.12 does not create an offer at that price. A larger purchase may need additional ask levels, and fees are separate.
Nor does 250.12 establish where a passive buy will fill. The calculation has no field for your order's arrival time, quantity ahead or cancellations within a queue. The limit-order queue estimation guide shows why aggregate displayed size cannot resolve those details.
Trade VWAP answers another question: the quantity-weighted average of executed trades over a stated sample. Weighted midpoint uses currently displayed quotes. A candle's typical price uses a candle summary. The trade VWAP versus typical price comparison helps select a benchmark that matches the record you actually have.
For example, if the bid size in our constructed book falls from 24 to 6 while ask size stays at 6 and both prices remain fixed, W returns from 250.12 to 250.00. That can happen through a cancellation in the hypothetical scenario, with no execution at either reference. A moving weighted quote is therefore not proof of traded demand.
Reject misleading inputs before reading the result
The formula is short; a reliable observation requires more care. For this worksheet, require finite positive prices and sizes and an ask above the bid. Flag other states for investigation before interpreting the weighted reference.
| Failure case | Why the output misleads | Useful response |
|---|---|---|
| Bid and ask come from different moments | The combined book may never have existed | Preserve a coherent quote update or correctly reconstructed state |
| One side uses tokens, the other quote notional | The size ratio mixes incompatible quantities | Normalize both sides to the same defined units |
| A best level disappears but its old price remains | The calculation weights an obsolete quote | Refresh the best level before recomputing |
| Missing sizes are silently replaced with zero | A missing value can pull the reference to an endpoint | Flag the observation as unavailable |
| Total size is zero | Division is undefined | Reject the record; do not manufacture a quote |
| Feed is stale or recovery is incomplete | Correct arithmetic describes an unreliable state | Suspend use until a supported current state is available |
Treat a zero best-level size as a reason to inspect state maintenance, even though the formula has a mathematical endpoint when only one size is zero. A removed level and the next best price need to be processed together before interpreting a live two-sided book.
Displayed quantity also describes an observation, not a commitment that it will remain until your order arrives. Its change alone cannot tell you whether traders canceled, replaced or executed orders. Preserve the relevant events if that distinction matters to the analysis.
Use a validation worksheet before comparing predictions
Begin with a small record you can reproduce by hand. Save venue, instrument, price units, quantity units, bid, ask, both sizes, receipt time, any supplied exchange time and update identifiers. Record whether the value is M, the simple W, or a named fitted model.
Run the balanced, larger-bid and larger-ask cases above. Also multiply both quantities by the same positive factor: 24/6 and 240/60 must produce the same weighted midpoint. The statistic captures their proportion, so identical outputs do not imply identical available liquidity. Keep absolute quantities beside it.
If you want to evaluate predictive usefulness, specify the target first. The next midpoint change and the midpoint one second later are different targets. Choose one, keep the observations chronological, fit any model using earlier data, and evaluate it on a later held-out period. Compare errors against the ordinary midpoint at the same observation times, including invalid or stale records in a documented exclusion count.
Finally, keep forecast evaluation separate from execution evaluation. A smaller midpoint forecast error does not incorporate spread crossing, fees, latency, passive fill uncertainty or the available depth for your quantity. A usable quote record should let another reader reproduce the weighted price, identify its definition and see exactly when its inputs stopped being trustworthy.
