Aperiodic
DataAlpha
CatalogOrder FlowL1 & L2Derivatives & Market Data
Get Started

Introduction

Market Microstructure Guide

Market microstructure studies how trading actually happens: how orders interact, how liquidity is supplied, and how prices absorb information in real time. It explains why two markets with the same headline price can offer very different trading conditions once spread, depth, queue position, and price impact matter.

Core concepts

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.

The spread is a risk price, not just a cost

The spread is the gap between what buyers offer and what sellers ask. Market makers set it wide when they’re nervous — like a store charging more for something they’re not sure they can restock. A widening spread is an early warning that something is off, before prices visibly react.

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.

Order flow separates noise from information

Every trade has a buyer and a seller, but one of them pushed — they were in a hurry. Order flow tracks who is pushing and how hard. When a lot of urgent buyers show up at the same time prices are swinging wildly, that’s when being a market maker gets expensive and dangerous.

Impact is the central cost of active investing

Every trade nudges the price. Bigger trades nudge more. Impact measures how much price moves per dollar traded. In thin markets that nudge is large, so investors demand higher returns to take the risk of getting in and out. That’s why less liquid assets often have higher expected returns.

Time matters at short horizons

In fast markets, milliseconds matter. When quotes are updating furiously but the price barely moves, someone may be flooding the system with fake orders to slow down competitors. Clustering of trades in time also signals urgency that average bars completely hide.

Essential metrics

These metrics form a dependency chain, not a checklist. Volatility sets the regime. Spread and depth define resting liquidity within it. Imbalance and flow describe the pressure being applied. Impact and slippage measure what happens when pressure meets supply. No single number is diagnostic on its own — the signal is always in the combination, and the combination changes with the regime.

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

Order flow and trade composition

BUY ↑SELL ↓← TIME →

Not all trades carry the same information. Barclay & Warner (1993) found that medium-sized orders — not the largest — account for a disproportionate share of cumulative price impact. Informed traders deliberately size down to avoid detection. This means aggregate volume alone is insufficient: you need to decompose flow by direction, size, and concentration to understand what it is actually telling you.

  • Volume delta — Buy-initiated minus sell-initiated volume. The directional pulse of the market — the net pressure that moved through the book over the interval.
  • Buy/sell ratio — The participation rate by side. A ratio that stays skewed across multiple bars is sustained pressure, not noise. Brief spikes wash out; persistent skew does not.
  • Trade size segmentation — Volume split into small, medium, and large buckets. When the large-trade buy ratio diverges from the small-trade buy ratio, you are seeing disaggregated flow — the classic microstructure signature of informed accumulation happening alongside retail noise.
  • Flow toxicity — Rooted in Easley, López de Prado & O’Hara’s VPIN framework. Relates signed net flow to realized volatility. When both are high simultaneously, adverse selection costs spike and spreads should widen — that is when liquidity provision is most dangerous. Low toxicity in a range-bound market means cheap, reliable liquidity. Some instruments attract systematically more toxic flow than others, which matters for cross-asset risk sizing.
Intro to Aperiodic Flow Metrics
Interactive notebook

Impact and execution cost

BUY FLOW →← SELL FLOW↑ Δ PRICEλ

Kyle’s lambda and Amihud illiquidity approach the same question from opposite ends: how much does trading move the price? Lambda measures information content per unit of signed flow; Amihud measures return per dollar of volume. Where they agree, the market is behaving consistently. Where they diverge is where the diagnosis gets interesting — rising Amihud without rising lambda points to exogenous volatility, not informed flow. Rising lambda alone means someone in the order flow knows something the quote does not yet reflect.

  • Amihud illiquidity — Absolute return divided by dollar volume. When this is high, small trades are moving price disproportionately — the market cannot absorb even modest flow without repricing.
  • Kyle lambda — The slope of price change versus signed order flow. Higher lambda means each dollar of directional flow moves the midpoint further — either because liquidity is thin or because the flow carries information the market maker is pricing in real time.
  • Directional impact asymmetry — Buy-side and sell-side lambda are rarely equal. Markets often absorb sells more efficiently than buys, especially in trending environments where sell pressure is expected and already priced.
  • Slippage — The gap between what the quote promised and what execution delivered. Perold (1988) called it implementation shortfall — the distance between paper portfolio returns and real returns. This is where backtest assumptions meet reality.
  • Buy-sell slippage asymmetry — Persistent buy > sell slippage means the market is paying up for demand — accumulation pressure. The reverse means liquidation pressure. Symmetric slippage is the rare condition where both sides face equal friction, indicating a genuinely two-sided market.

Derivatives context

LONG CROWDEDSHORT PRESSURE0FUNDING RATEOI

In crypto perpetual futures, funding rate, basis, and open interest are the primary indicators of leverage positioning and directional crowding. When funding, basis, and open interest all point the same direction, the market is building a position that will eventually need to unwind.

  • Funding rate — The real-time price of directional consensus in leveraged markets. Strongly positive funding means longs are paying to hold, and crowded positioning raises liquidation cascade risk. Strongly negative funding reflects genuine fear.
  • Basis (bps) — The perp-spot spread is the marginal cost of leverage.
  • Open interest — Total outstanding contracts. Rising OI with rising price means new longs entering. Rising OI with falling price means new shorts are being opened. Declining OI means positions are being unwound — the market is getting lighter regardless of direction.
Intro to Aperiodic Derivatives Metrics
Interactive notebook

Continue into the datasets

Once the concepts are clear, the next step is to study the actual metric families: order flow composition, top-of-book liquidity, multi-level depth, price impact, and derivatives state variables. Each dataset page includes the academic background, what we measure, and why it matters for research.

Open Interest

Open Interest

Open interest values with percentage change, volatility, and OI/price change ratio.

CodeAPI DocsTry It

open_interest

Open Interest

Open Interest tracks the total outstanding derivatives exposure and serves as the balance-sheet backdrop for price action.

Rising open interest means new positions are being opened or expanded, while falling open interest suggests risk is being reduced or closed out.

open_interest_pct_change

Open Interest % Change

Open Interest % Change shows how quickly positioning expanded or contracted over the interval.

This is often more informative than the raw level because it makes sudden positioning events immediately visible.

open_interest_volatility

Open Interest Volatility

Open Interest Volatility measures how unstable outstanding positioning was inside the bar.

High values can indicate frequent leverage adjustments, position recycling, or stress-driven churn rather than steady accumulation.

oi_price_change_ratio

OI/Price Change Ratio

OI/Price Change Ratio compares how much positioning changed relative to the magnitude of the price move.

It helps answer whether price action was accompanied by substantial leverage participation or happened mostly without new positioning.

Endpoint

/api/v1/data/open_interest

Category

Derivatives

Intervals
1m5m15m30m1h4h1d
Exchanges
binance-futuresokx-perpshyperliquid-perps
Fields4
open_interestOpen InterestLast open interest value in the interval
open_interest_pct_changeOpen Interest % ChangePercentage change in open interest from the first value to the last value in the interval
open_interest_volatilityOpen Interest VolatilityStandard deviation of tick-to-tick open-interest percentage changes in the interval
oi_price_change_ratioOI/Price Change RatioOpen-interest return divided by mark-price return over the interval
Example Request
from datetime import date
from aperiodic import get_derivative_metrics
df = get_derivative_metrics(
api_key="YOUR_API_KEY",
metric="open_interest",
exchange="binance-futures",
symbol="perpetual-BTC-USDT:USDT",
interval="1d",
start_date=date(2024, 1, 1),
end_date=date(2024, 3, 1),
)
print(df.head())

Query Parameters

timestampreqstring
string

Timestamp source. 'exchange' uses the exchange-reported timestamp, 'true' uses actual arrival time at our servers.

exchangetrue
intervalreqstring
string

Aggregation time interval for the data.

1m5m15m30m1h4h1d
exchangereqstring
string

Source derivatives exchange for the data.

binance-futuresokx-perpshyperliquid-perps
symbolreqstring
string

Trading pair symbol in the format of Atlas' universal symbology: https://github.com/aperiodic-io/atlas

start_datereqstring<date>
string<date>

Start date for the data range (YYYY-MM-DD format). Data is partitioned by year and month.

end_datereqstring<date>
string<date>

End date for the data range (YYYY-MM-DD format). Must be greater than or equal to start_date.

Successful response with download URLs for each monthly file

Schema
filesobject[]required

Array of file information for each month in the requested date range

yearintegerrequired

Year of the data file

monthintegerrequired

Month of the data file (1-12)

urlstring<uri>required

Presigned URL for direct file download (valid for 5 minutes). URLs are served from dataset-specific subdomains, e.g. ohlcv.aperiodic.io, trade-metrics.aperiodic.io, l1-metrics.aperiodic.io, l2-metrics.aperiodic.io, derivative-metrics.aperiodic.io.

Example
{
  "files": [
    {
      "year": 2024,
      "month": 1,
      "url": "https://ohlcv.aperiodic.io/binance-futures/1h/BTCUSDT/2024-01.parquet?X-Amz-Expires=300&..."
    },
    {
      "year": 2024,
      "month": 2,
      "url": "https://ohlcv.aperiodic.io/binance-futures/1h/BTCUSDT/2024-02.parquet?X-Amz-Expires=300&..."
    }
  ]
}
Try It
Suggestions shown — any valid value accepted
Suggestions shown — any valid value accepted
Suggestions shown — any valid value accepted
Authentication
An API key is required to send requests.Sign up
GET/api/v1/data/open_interest?timestamp=exchange&interval=1m&exchange=binance-futures
Response will appear here
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
  • Microstructure Guide
  • For AI Agents
Metrics
  • Order Flow
  • L1 — Top of Book
  • L2 — Order Book
  • Market Data
  • Derivatives
Channels
  • Blog: Research Insights
  • Telegram: Announcements
  • Twitter/X
  • LinkedIn
Company
  • Contact
  • Book a call
Legal
  • 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.