Order-Book Dynamics
5 algorithms in Market Microstructure.
In this family#
-
Order-Book Slope contract
How steeply depth accumulates as you move away from the touch. A steep book absorbs size with little price movement; a flat one does not — it is a liquidity measure that the spread alone cannot express.
orderBookSlope(bidPrices, bidSizes, askPrices, askSizes) -
Depth-Weighted Midprice contract
A midpoint weighted by depth across several levels rather than the naive average of best bid and ask. Less prone to jumping when a single small order sits at the touch.
depthWeightedMidprice(bidPrices, bidSizes, askPrices, askSizes) -
Microprice contract
The midpoint weighted by the *opposite* side's size, so a heavy bid pulls the price up. Counter-intuitive until you see the derivation — the imbalance predicts where the midpoint is going, not where it is.
microprice(bid, bidSize, ask, askSize) -
Order-Book Resiliency contract
How quickly the book refills after being depleted, fitted as a decay over observed displacement. Resiliency is the third dimension of liquidity beside spread and depth, and the one that decides whether a large order can be worked at all.
orderBookResiliency(timesSeconds, displacementBps, forecastSeconds) -
Hawkes Order-Arrival Model contract
A self-exciting point process: each arrival raises the probability of the next. It captures order clustering that a Poisson model cannot, which is why order flow looks bursty rather than smooth.
hawkesOrderArrival(eventTimesSeconds, baselineIntensity, excitationJump, decayRate, evaluationTimeSeconds, horizonSeconds)
What they share#
Every topic here is a record-transform, so once you have
called one the rest follow the same shape. Import paths differ only in the final segment:
import { orderBookSlope } from "fintech-algorithms/market-microstructure/order-book-dynamics/order-book-slope";
import { depthWeightedMidprice } from "fintech-algorithms/market-microstructure/order-book-dynamics/depth-weighted-midprice";Read them in the order above — the sequence is pedagogical, not alphabetical.
Where this sits#
Market Microstructure collects 29 algorithms across 5 families. For the concept behind this family rather than the call signatures, see the concept guides.