The immediate exchange
The best bid is the highest displayed buying price; the best ask is the lowest displayed selling price. Their difference is the quoted spread. A marketable buy consumes asks. A marketable sell consumes bids. Larger orders may reach additional price levels.
The midpoint is a useful reference, but it is not an executable promise. Resting depth can change before your order arrives, and a limit order may wait behind other orders or never fill.
Try the spread arithmetic
This exercise holds the book fixed. Buy one unit at the ask and immediately sell it at the bid. Apply the same fee in basis points to each executed notional.
One basis point is 0.01%. This calculation excludes additional slippage, market impact and changes in the book.
Displayed imbalance is a feature
Define which levels contribute to Q and how prices are sampled. Imbalance is a description of visible resting size; its predictive usefulness needs a separate out-of-sample test. Executed order flow and displayed depth are different measurements.
Inventory changes the decision
A market maker's quote depends on fair value, position, risk and execution probability. Capturing a quoted spread is not automatic profit: the filled side can be followed by an adverse price move. Inspect inventory paths and fill-conditioned outcomes as well as PnL.
A practical experiment
In Tomorrow Markets, compare a small market order with a non-marketable limit order. Record arrival time, fill time, execution price, inventory and the subsequent price path. Repeat under the same settings and record the data source. The experiment teaches mechanics; it does not validate an edge in a different market.