Glossary¶
Brief definitions of the market-microstructure jargon used throughout ob-analytics. Each entry links to the relevant API or concept. For a from-scratch introduction, start with the tutorial chapter From a price to an order book.
Exchange mechanics¶
Exchange / bourse : A venue where strangers trade a standardized instrument by posting firm, standing offers instead of haggling pairwise. The public list of those offers is the order book.
Matching engine : The exchange's neutral component that pairs compatible buy and sell orders under fixed, published rules and reports the resulting trades.
Continuous double auction : The market design run by modern exchanges: both sides post offers ("double"), and matching happens the moment offers become compatible, all session long ("continuous") — rather than at a scheduled auction time.
Price–time priority : The standard matching rule: better-priced orders trade first, and at the same price, earlier arrivals trade first. The within-price queue it creates is what Level 3 data (and the queue engine) lets you reconstruct.
Market data levels¶
Level 1 (L1) : The top-of-book summary: best bid, best ask, and last trade. What brokerage apps and tickers show as "the price".
Level 2 (L2) — market by price : The full ladder of price levels with aggregate size at each level. Individual orders are summed away.
Level 3 (L3) — market by order : Every individual order with its own identity and queue position — enough to replay arrivals, cancellations, and fills exactly. Also called market-by-order (MBO) data. This is the resolution ob-analytics reconstructs from Bitstamp and LOBSTER feeds.
Best bid / best ask : The highest standing buy price and lowest standing sell price. The ask minus the bid is the spread; their average is the mid-price.
Last trade : The most recent execution's price — the number headlines call "the price", which can move without any trade (see the flash example in the tutorial).
Order book mechanics¶
Limit order : An instruction to buy (bid) or sell (ask) at a specified price or better. Sits in the book until matched, modified, or cancelled.
Market order : An instruction to execute immediately against the best available counter-side liquidity. Modeled in this package as a limit order whose price crosses the spread on arrival.
Maker / taker
: The maker is the resting side of a trade (the limit order that was
already in the book); the taker is the aggressive side that crossed the
spread to consume it. See the maker_event_id / taker_event_id columns
documented in Data Contracts.
Spread
: Best ask price minus best bid price, in ticks — see Tick size below.
Extracted from the depth summary via
get_spread.
Mid-price
: (best_bid + best_ask) / 2, in ticks — see Tick size below. Reference
price for measuring order aggressiveness in basis points.
Tick size
: The instrument's minimum price increment, in quote currency. Every
price column is stored as a whole number of ticks (int64), not a float
in the quote currency; multiply by
PipelineConfig.tick_size
to recover the quote-currency price.
Basis point (BPS)
: 1/100 of a percent. The depth summary bins liquidity into rings of
depth_bps width around the mid-price; see
PipelineConfig.depth_bps.
Order classifications¶
Produced by set_order_types,
which assigns one of six categories.
Unknown
: The initial, unclassified state. Remains on any order that fits none of
the other categories once classification finishes; set_order_types logs a
warning when this happens, since it signals a classification gap rather
than a normal outcome.
Pre-existing
: An order first seen part-way through the stream, with no created row —
the opening book at capture start, or a hidden execution. Structurally
unclassifiable rather than a classification failure, so it gets its own
category instead of falling back to unknown.
Resting limit : A passive limit order that sits in the book and is eventually filled or cancelled without ever crossing the spread.
Market : An order that crosses the spread on arrival and executes immediately.
Market-limit : A limit order that crosses on arrival but, after partial fills, comes to rest as a passive order at a price inside the book.
Flashed-limit : A limit order that is created and cancelled within a very short window without ever filling. Common in HFT quote-stuffing patterns.
Flow toxicity¶
Implemented in flow_toxicity.
VPIN — Volume-Synchronized Probability of Informed Trading : Easley, López de Prado, & O'Hara (2012). Bucket trades by equal volume, classify each bucket as buy- or sell-driven, and report the rolling absolute imbalance. High values (≳0.7) signal informed-trader pressure.
Kyle's lambda (λ)
: Kyle (1985). Slope of Δprice ~ signed_volume regression over a rolling
window. Higher λ → less liquid market (more adverse-selection cost per unit
of order flow). Returned as a KyleLambdaResult
with the regression DataFrame attached.
Order flow imbalance (OFI) : Per-window net buy-minus-sell volume normalised by total traded volume. A short-horizon proxy for directional pressure.
Pipeline concepts¶
Canonical events / trades frames : The venue-independent DataFrames every pipeline stage consumes, defined by the column contracts in Data Contracts. Once frames pass the validators, downstream code cannot tell which venue they came from.
Loader
: Produces the canonical frame for a source, via create_loader. An L3
source's create_loader returns an EventLoader,
whose load() returns a validator-passing events frame; an L2 source
returns a DepthSource, whose load() returns the
depth frame directly, since a price-level feed has no per-order events to
fold. One per venue dialect.
Trade source
: The companion protocol for executions: load(events, source) returns
the canonical trades frame with maker/taker attribution.
Metric
: A measurement taken from a finished run — registered under a name in
METRICS, computed on demand by result.metric(name), and drawn as a
level-less plot under that same name. See
Metrics and Extending.
Data formats¶
Matched book : An L3 feed produced by the venue's own matching engine (LOBSTER, exchange MBO feeds): bids can never rest above asks, so an uncrossed book is a guaranteed invariant of the data.
Diff feed
: An L3 feed reconstructed from a public placement/cancellation
stream (the Bitstamp feed used here). It can contain genuinely crossed
resting orders; order_book() replays such feeds faithfully — a
crossed book in the output is a property of the feed, not a
reconstruction bug. See the pitfall note in
L1 → L2 → L3 and the
Data quality explainer, which shows how to measure the
crossing (audit) and uncross it for display (uncross=).
Bitstamp CSV
: One row per order event with columns id, timestamp, exchange_timestamp,
price, volume, action, direction. The pipeline also expects a sibling
trades.csv with live-trade columns (trade_id, timestamp, price,
amount, buy_order_id, sell_order_id, side, …) — see
scripts/collect_bitstamp_btcusd.py.
LOBSTER : Lim-Order-Book-System-The-Efficient-Reconstructor data set (lobsterdata.com). Provides paired message and orderbook CSV files; integer prices in ten-thousandths of a dollar; timestamps in seconds-after-midnight. Event types 1–7 cover submissions, cancellations, executions of visible/hidden liquidity, cross trades, and trading halts.