Aperiodic
DataAlpha
CatalogOrder FlowL1 & L2Derivatives & Market Data
Get Started

L1 & L2 — Order Book

Top-of-book and multi-level order book analytics.

From best bid/ask spread and depth to multi-level imbalance and liquidity dynamics — comprehensive order book data aggregated for high-resolution microstructure research.

Highlighted Metrics

midprice

Mid Price

Mid Price is the center of the best bid and best ask, making it the cleanest instantaneous fair-value proxy at the top of book.

Because it strips out half-spread noise, it is widely used for microstructure research, marking, and short-horizon return calculations.

weighted_midprice

Weighted Mid Price

Weighted Mid Price tilts the simple midpoint by the relative size resting at the best bid and ask.

That gives it a predictive flavor because it incorporates which side of the top of book is showing more immediate depth.

quote_update_frequency

Quote Update Frequency

Quote Update Frequency measures how actively the top of book was refreshing during the interval.

A high reading often means the market was competitive, reactive, or unstable enough to force frequent repricing.

avg_update_interval

Avg Update Interval

Average Update Interval is the time counterpart to quote frequency, showing how quickly the best quotes changed on average.

Shorter intervals imply a faster and more responsive book, while longer intervals suggest a calmer or less actively managed top of book.

bid_price_vwap

Bid Price VWAP

Bid Price VWAP summarizes where the best bid spent its time with volume-sensitive weighting.

It offers a richer picture than a single snapshot because it reflects how quoted buying interest evolved across the bar.

imbalance

Imbalance

Imbalance measures the raw difference between bid-side and ask-side top-of-book size.

It is one of the fastest ways to see which side is presenting more immediate resting interest at the best quotes.

imbalance_ratio

Imbalance Ratio

Imbalance Ratio scales the raw difference into a relative measure that is easier to compare across symbols and market states.

Because it normalizes for total top-of-book size, it often gives a cleaner signal than the raw imbalance alone.

bid_ask_ratio

Bid/Ask Ratio

Bid/Ask Ratio directly compares the best-bid size with the best-ask size.

It is intuitive, portable, and useful when you want to know whether displayed buying depth materially outweighed displayed selling depth.

bid_percentage_avg

Avg Bid %

Average Bid % shows the mean share of top-level liquidity that sat on the bid across the interval.

This smooths through flicker and highlights the prevailing balance of displayed interest instead of a single instant.

ask_percentage_avg

Avg Ask %

Average Ask % is the complementary view, capturing how much of top-level liquidity tended to sit on the ask side.

Monitoring the bid and ask averages together helps reveal whether one side dominated persistently or whether the book spent the interval near equilibrium.

spread_bps

Spread (bps)

Spread in basis points measures the instantaneous cost of crossing from the best bid to the best ask on a normalized scale.

It is one of the most direct and actionable summaries of top-of-book trading conditions.

spread_depth_ratio

Spread/Depth Ratio

Spread/Depth Ratio combines price width and displayed size into a single liquidity efficiency measure.

A market with tight spreads but little size can still be fragile, and this ratio helps expose that weakness.

total_dollar_depth

Total Dollar Depth

Total Dollar Depth aggregates the top-level bid and ask liquidity in value terms.

This gives a more practical view of executable size than raw units, especially across instruments with different prices.

dollar_depth_bid_avg

Avg Bid Dollar Depth

Average Bid Dollar Depth tracks the mean value resting on the bid at the top of book throughout the interval.

It helps answer whether supportive displayed buying liquidity was consistently present or only flashed briefly.

dollar_depth_ask_avg

Avg Ask Dollar Depth

Average Ask Dollar Depth provides the matching view for displayed sell-side liquidity at the best offer.

Comparing it with the bid average helps reveal whether one side of the book was structurally thinner or thicker during the bar.

imbalance_5

Imbalance (5 levels)

Imbalance across five levels extends top-of-book pressure into the near-touch order book.

It reveals whether directional support is just a quote-level artifact or is backed by additional nearby depth.

imbalance_ratio_25

Imbalance Ratio (25 levels)

The twenty-five-level imbalance ratio normalizes deep-book pressure over a broader slice of resting liquidity.

It is useful for understanding the full displayed environment that larger orders would have to push through.

bid_ask_ratio_25

Bid/Ask Ratio (25 levels)

The twenty-five-level ratio extends that comparison deep enough to capture broader displayed inventory.

It is especially relevant for larger execution and for understanding whether apparent pressure near the touch is reinforced deeper in the ladder.

ask_agg_25_avg

Avg Ask Aggregate (25 levels)

Average Ask Aggregate across twenty-five levels smooths the deeper sell-side book over the interval.

That makes it a regime measure for how much overhead liquidity the market was consistently showing, not just flashing moment to moment.

bid_agg_25_avg

Avg Bid Aggregate (25 levels)

Average Bid Aggregate across twenty-five levels provides the broad matching view of displayed support.

Stronger readings indicate a deeper cushion of resting liquidity that can absorb pressure before the book thins out materially.

L1 — Top of Book Datasets

L1 Price

Tier 2

Best bid and ask prices with quantities, midprice, quantity-weighted midprice, time/volume-weighted averages, and quote update frequency.

Key fields

Mid PriceWeighted Mid PriceBid Price TWAPAsk Price VWAP

L1 Imbalance

Tier 3

Bid/ask imbalance, ratio, percentages — both instantaneous (last) and averaged over the interval.

Key fields

ImbalanceImbalance RatioBid/Ask RatioAvg Imbalance

L1 Liquidity

Tier 3

Spread (absolute and bps), depth, dollar depth — instantaneous and interval-averaged.

Key fields

Spread (bps)Total DepthTotal Dollar DepthAvg Spread (bps)

L2 — Order Book Datasets

L2 Order Book Imbalance

Tier 3

Multi-depth (5, 10, 20, 25 levels) order book imbalance, ratio, and averages.

Key fields

Imbalance (5 levels)Imbalance (20 levels)Imbalance (25 levels)Imbalance Ratio (5 levels)

L2 Order Book Liquidity

Tier 3

Total bid/ask depth aggregated over 5, 10, 20, 25 order book levels — instantaneous and interval-averaged.

Key fields

Ask Aggregate (10 levels)Ask Aggregate (20 levels)Ask Aggregate (25 levels)Bid Aggregate (10 levels)

Market Microstructure Context

The order book is the market's immediate state

Think of the order book as two lines at a checkout: one side wants to buy, the other wants to sell. The price is set by whoever is at the front of each line. When buyers start piling up faster than sellers, the price moves up and you can see that coming before it happens.

Depth determines resilience under pressure

Depth is how many people are standing in line behind the front. A long line means a big order won't shift the price much. A short line means one large trade can send the price flying. A book that looks full at the top but empty underneath is the most dangerous — it feels safe until it isn't.

Spread and top-of-book liquidity

BID DEPTHASK DEPTHSPREAD

The spread is the price of immediacy — what the market maker charges to bear adverse selection risk right now. Huang & Stoll (1997) decomposed it into adverse selection, inventory, and order processing costs, which is why a widening spread is diagnostic, not just expensive. But the average hides the regime change: a bar with mean spread of 2 bps that was 0.5 bps for 55 seconds and 8 bps for 5 seconds tells a fundamentally different story than a steady 2 bps. Bollerslev & Melvin (1994) showed spread volatility itself predicts future return volatility — the instability of the spread matters as much as its level.

  • Quoted spread — The gap between best ask and best bid. The sticker price of trading — what you see, not necessarily what you get once real size hits the book.
  • Spread in basis points — Price-normalized spread for cross-asset comparison. A 1-cent spread means something very different on a $10 asset versus a $50,000 one.
  • Top-of-book depth — How much size sits at the best prices. A 1 bps spread on 50k of depth is a different market than 1 bps on 500k. This tells you the cost of the first fill — not whether the market survives the second.
  • Spread/depth ratio — The honesty check on tight spreads. Low ratio means genuinely cheap liquidity. High ratio means the narrow quote is decorative — it will not survive contact with real flow.
Intro to Aperiodic L1 Price Metrics
Interactive notebook

Order book imbalance

BID (heavy)ASK (thin)

Cont, Kukanov & Stoikov (2014) showed it clearly: order book imbalance predicts the direction of the next mid-price change, and the relationship is monotonic — stronger lean, larger expected move. The mechanism is straightforward. When one side is substantially thicker, the thinner side depletes first and the midpoint shifts. But the real insight is in the layers. L1 and L2 can tell contradictory stories, and the divergence between them is often more informative than either alone.

  • L1 imbalance — Best-bid versus best-ask quantity. A single snapshot is noisy; time-averaged imbalance over the interval is what actually predicts.
  • L2 imbalance — The same signal extended across 5, 10, 20, and 25 levels per side. Captures the full shape of supply and demand behind the frontier — L2 can be draining even while L1 looks stable.
  • L1-L2 divergence — Where the actionable signal lives. Thin L1 bids with deep L2 behind them is a market maker repositioning, not genuine weakness. Thick L1 bids with nothing behind them is a single concentrated quote — pull it and there is a gap.
  • Weighted midprice — Stoikov (2018) showed the quantity-weighted midprice — shifted proportional to size at each side — beats the simple midpoint as a predictor of the next transaction price.
Predicting Short-Term Crypto Returns with Market Microstructure
Interactive notebook

Use Cases

Spread-based execution cost modelling

Use average and instantaneous spread metrics to quantify market-making costs and estimate fill quality across instruments.

Deep liquidity analysis

Measure aggregate bid and ask depth at multiple levels to understand resilience and liquidity beyond the top-of-book.

Order book imbalance & directional signals

Detect directional pressure from top-of-book imbalance dynamics and build predictive features from multi-level imbalance ratios that capture it more robustly.

Iceberg & hidden order detection

Detect large resting orders by monitoring depth anomalies and imbalance dynamics across book levels over time.

Market resilience measurement

Quantify how quickly liquidity replenishes after consumption by analyzing depth averages and their variability.

Quote update frequency analysis

Identify quote stuffing patterns and measure market-maker activity intensity using update frequency metrics.

VWAP/TWAP quote benchmarking

Compare execution fills against bid/ask VWAP and TWAP to measure adverse selection in your order flow.

Multi-level feature engineering for execution & alpha models

Combine weighted mid-price, imbalance averages, and bid/ask depth at 5, 10, 20, 25 levels into composite signals for HFT, market-making, and ML-based alpha strategies.

Get started in minutes

pip install aperiodic
pypi ↗
example.py
from datetime import date
from aperiodic import get_metrics

df = get_metrics(
    api_key="your-api-key",
    metric="flow",
    timestamp="exchange",
    interval="1h",
    exchange="binance-futures",
    symbol="perpetual-BTC-USDT:USDT",
    start_date=date(2024, 1, 1),
    end_date=date(2024, 1, 31),
)

print(df.head())

Ready to start building?

Get access to our full catalog of market microstructure data.

Get started free
Get started
Aperiodic

Institutional-Grade Order Flow, Liquidity & Derivative Metrics — Turn market microstructure into actionable signals, alpha and analytics in minutes.

© Copyright 2026 Aperiodic. All Rights Reserved.

Product
  • Data Catalog
  • Pricing
  • API Docs
  • Notebooks
  • Roadmap
  • Changelog
  • FAQ
  • For AI Agents
Metrics
  • Order Flow
  • L1 — Top of Book
  • L2 — Order Book
  • Market Data
  • Derivatives
Channels
  • Research Insights
  • Microstructure Guide
  • Telegram
  • Twitter/X
  • LinkedIn
Company
  • Contact
  • Book a call
  • Terms of Service
  • Privacy Policy
  • LLM? Read this.

NOT INVESTMENT ADVICE

The Content is for informational purposes only, you should not construe any such information or other material as legal tax, investment, financial, or other advice. Nothing contained on our presentation constitutes a solicitation, recommendation, endorsement, or offer by Aperiodic or any third party service provider to buy or sell any securities or other financial instruments in this or in in any other jurisdiction in which such solicitation or offer would be unlawful under the securities laws of such jurisdiction.

All Content on this presentation is information of a general nature and does not address the circumstances of any particular individual or entity. Nothing in the presentation constitutes professional and/or financial advice, nor does any information on the Presentation constitute a comprehensive or complete statement of the matters discussed or the law relating thereto.

Aperiodic is not a fiduciary by virtue of any person's use of or access to the Presentation or Content. You alone assume the sole responsibility of evaluating the merits and risks associated with the use of any information or other Content on the Presentation before making any decisions based on such information or other Content. In exchange for using the Presentation, you agree not to hold Aperiodic, its affiliates or any third party service provider liable for any possible claim for damages arising from any decision you make based on information or other Content made available to you through the Presentation.

INVESTMENT RISKS

There are risks associated with investing in securities. Investing in stocks, bonds, exchange traded funds, mutual funds, and money market funds involve risk of loss. Loss of principal is possible. Some high risk investments may use leverage, which will accentuate gains & losses. Foreign investing involves special risks, including a greater volatility and political, economic and currency risks and differences in accounting methods. A security's or a firm's past investment performance is not a guarantee or predictor of future investment performance.