Quotes, spreads and reference prices
Replay quote events and decompose signed execution cost to reveal how a reference changes the comparison.
30 minutes · intermediate · Original Poker4Quant lessonWhat you will learn
Reconstruct two-sided quote states from typed events and derive signed cost as half-spread plus directional midpoint displacement relative to a declared reference.
Prerequisites: Price-time order matching · Fair prices and margins
A quote is a two-sided observation with a clock
A bid is a standing willingness to buy, while an ask is a standing willingness to sell. From the perspective of someone demanding immediate execution, selling meets the bid and buying meets the ask. The best bid is the highest displayed buying price and the best ask is the lowest displayed selling price. A completed trade is a different observation: it records an exchange that already happened. Its price can remain on screen after both current quotes change. A last trade therefore cannot replace a missing current side of the book.
Assume one synthetic venue, one instrument, synchronized event sequence numbers, positive chip prices, no fees, no hidden liquidity and exactly one unit of immediate execution. Every displayed side has enough size for that unit. Quotes are snapshots, not promises about future arrivals. Only uncrossed or locked snapshots are admitted: bid b is at most ask a. We exclude crossed books because their interpretation would require a different matching or data model. None of the numbers is market data. The exercise measures arithmetic relative to declared references, not fair value, investment merit or expected profit.
Build the current state by replaying quote events
The event tape starts at sequence 0 with bid 98 and ask 102. Sequence 1 records a completed trade at 102 but changes neither quote. Sequence 2 replaces only the bid with 100. Sequence 3 replaces only the ask with 104. Sequence 4 records a trade at 100 without changing quotes. Sequence 5 replaces the ask with 100, leaving a locked 100/100 snapshot. To reconstruct any sequence, begin at the initial state and apply only quote replacements up to and including that sequence. Do not infer an unreported quote update from a trade print.
For example, sequence 3 has bid 100, ask 104 and last trade 102. Sequence 4 has identical quotes but last trade 100. The spread and midpoint stay fixed even though the last trade moves. Sequence 2 instead has bid 100, ask 102 and last trade 102: the same last trade as sequence 3, but different quotes. These paired counterexamples establish both directions of non-equivalence. Replaying state is more reliable than selecting the most recently seen number without checking which field it updates. In a real feed, ordering and timestamp integrity would themselves need verification.
Separate width, center and an executable side
Define quoted spread S=a−b and midpoint m=(a+b)/2. Spread measures distance between displayed sides in chips per unit. Midpoint locates their arithmetic center in the same units; it does not add new executable liquidity. At sequence 3, S=104−100=4 and m=204/2=102. An immediate one-unit buyer pays 104; a seller receives 100. Neither executes at 102 in our mechanism. An even-looking midpoint can coincide with an earlier trade price by accident without turning into an available order.
A spread can narrow because the bid rises, because the ask falls, or because both move inward. Center movement is a separate question. From sequence 0 to sequence 2, width falls from four to two while center rises from 100 to 101. From sequence 2 to sequence 3, width rises to four while center rises again to 102. Calling a narrower spread a price decline confuses width with location. At sequence 5, S=0 and m=100. Both immediate sides equal the midpoint, but zero quoted width says nothing about fees, future changes, greater quantities or an instrument’s underlying economic value.
Derive signed cost and expose the benchmark term
Let d=+1 for buying and d=−1 for selling, let p be the executable side price, and choose reference r. Define signed cost C(r)=d(p−r), in chips per unit. A positive value means paying above the reference when buying or receiving below it when selling. A negative value means the reverse comparison. This common orientation allows both sides to use the same algebra, but it is a definition of a benchmark comparison rather than an assertion about realized profit. Buying and selling need opposite signs because higher prices harm buyers and benefit sellers.
Insert and subtract the current midpoint: C(r)=d(p−m)+d(m−r). For an immediate buy, p=a and a−m=(a−b)/2. For an immediate sell, p=b and −(b−m)=(a−b)/2. Consequently C(r)=S/2+d(m−r) for either side under our one-unit execution assumptions. The first term is the same nonnegative half-spread; the second term carries the chosen reference and trade direction. This is an exact algebraic identity, not a statistical estimate. It fails as a quoted-half-spread execution formula if an order walks deeper prices, pays fees or receives a different execution price.
Use a reference counterexample before making a claim
At sequence 3 a seller receives p=100. Relative to the current midpoint r=102, C=−1×(100−102)=2. Relative to the initial midpoint r=100, C=0. Relative to the initial ask r=102, it again equals two; that numerical agreement does not make those two reference definitions interchangeable. For a buyer at the same snapshot, p=104 and the initial midpoint gives cost four, decomposed into half-spread two plus midpoint movement two. Direct subtraction and the two-term identity independently agree.
Now use sequence 2 and the initial ask reference 102. Buying costs 102, so C=0. Selling receives 100, so C=2. At sequence 0, a buyer’s cost relative to initial ask is also zero even though the spread is four. A zero comparison to an ask reference has not eliminated the quoted spread. At sequence 5, buying at 100 relative to initial ask 102 gives C=−2 despite zero width. Changing only the benchmark can change a cost sign without changing any execution. Always name side, sequence, execution assumption and reference before interpreting that sign.
In the workshop, assemble the current bid, ask and last trade from the event tape. Change sequence, side and reference independently, then audit spread, midpoint, execution price and both signed-cost terms. Try a trade-only event, a locked quote and a negative reference comparison. Every configuration change clears earlier answers so an old success cannot certify a new state. A missing last trade must be entered as none; it is not zero. The reference choices deliberately include an initial ask to make benchmark dependence visible. They are comparison conventions, not recommendations or standardized transaction-cost reports.
Worked example
At sequence 3, compare immediate one-unit buying and selling against the initial midpoint 100.
- Replay: bid 98 becomes 100 at sequence 2; ask 102 becomes 104 at sequence 3. Last trade remains 102.
- Spread=104−100=4; midpoint=(100+104)/2=102; half-spread=2.
- Buy: p=104, d=1, C=104−100=4. Identity: 2+1×(102−100)=4.
- Sell: p=100, d=−1, C=−1×(100−100)=0. Identity: 2−(102−100)=0.
- Change only the seller reference to current midpoint 102: C=−1×(100−102)=2. The actual sale is unchanged.
Same width, different side and reference comparisons. A cost sign is meaningful only with its benchmark and event boundary.
Hands-on: Reconstruct a quote timeline
Replay typed events and audit executable sides and signed reference decompositions.
Reconstruct a quote timeline
One unit, one venue, synchronized events, no fees. Draft lasts for this visit; no game or lesson credit. Construct source events before calculating the snapshot.
0: initialize bid 98, ask 102; no trade
1: trade 102 only
2: replace bid with 100
3: replace ask with 104
4: trade 100 only
5: replace ask with 100
Choose the observation boundary
Sequence 3; buy; reference initial-mid = 100 chips per unit.
Construct the source of each current field
Bid source
Ask source
Last trade source
Replay the tape before auditing.
Common mistakes
- Updating quotes from an event that only reports a trade.
- Treating midpoint or last trade as an executable side.
- Forgetting the sell sign or charging a full spread for a one-sided midpoint comparison.
- Calling a negative benchmark comparison realized profit.
Keep these ideas
- Replay each field using only its typed events.
- Spread is ask minus bid; midpoint is their arithmetic center.
- Immediate buys use ask and sells use bid under the stated assumptions.
- Signed cost equals half-spread plus directional reference displacement.
Further reading
- SEC Investor.gov: Bid Price/Ask Price ↗
Read the two definition paragraphs for bid, ask and spread. Supports terminology only. Original event tape, midpoint algebra, signed-reference identity, examples and checks; no quotes or video review. Checked 2026-10-25.