Aperiodic
MarketsLive
Pricing
Get Started

Metrics library · Order flow

Trade run structure

Get the data
BTC-USDT perpetual on Binance, 5m bars, 1 to 31 May 2025, from the free preview. The free delayed feed doesn't carry this dataset; paid plans stream it in real time.
How it's builtBTC, May 2025FieldsDownloadFAQ

How long runs of same-side trades last and how often the side flips.

Consecutive same-direction trade run lengths, imbalance, flip rate, and price change on direction flip.

Built from
Trades
Fields
7
Intervals
1m to 1d; 15s and 30s on Prime
Plan
Pro
Venues
Binance, OKX, Hyperliquid
Live
Real time on paid plans

How it's built

One real minute of trades, field by field. Each value matches our pipeline's output.

All 11,692 trades from 14:38 to 14:39 UTC on 11 June 2025, Binance BTC-USDT perpetual, from the free raw-trades preview.

  1. Step 1

    Split the trades into runs

    A run is a streak of consecutive trades with the same taker side. This minute had 1,200 runs, 600 of taker sells and 600 of taker buys.

    Loading 11,692 trades…
  2. Step 2

    Measure the runs

    sell_run_max_len=longest sell streak=339
    buy_run_max_len=longest buy streak=124
    sell_run_mean_len=mean sell streak=13.52
    buy_run_mean_len=mean buy streak=5.97

    The longest, 339 taker sells in a row, started at 14:38:19.1. The price moved -1.36 bps from its first trade to its last.

    Loading 11,692 trades…
  3. Step 3

    Flip rate and imbalance

    flip_rate=1,199 flips / 11,692 trades=10.3%
    run_imbalance=(buy max − sell max) / (buy max + sell max)=-0.464
    price_change_on_flip=mean |return| at a flip=0.108 bps
  4. Step 4

    The bar

    buy_run_max_len
    124
    sell_run_max_len
    339
    buy_run_mean_len
    5.97
    sell_run_mean_len
    13.52
    run_imbalance
    -0.464
    flip_rate
    0.1025
    price_change_on_flip
    1.08e-5

Do one-sided bars move BTC further?

BTC bars where trades rarely changed side moved 2.8× as far as bars where they flipped often.

BTC-USDT perpetual on Binance, 5m bars, 1 to 31 May 2025, from the free preview.

Median size of the move in the same bar
8.37
7.82
7.35
7.36
6.00
6.00
5.74
5.22
4.00
3.02
12345678910

Bars by flip rate, fewest flips to most. Basis points.

Sorted by flip rate, the tenth of bars with the fewest flips had a median move of 8.37 bps, the tenth with the most 3.02 bps. Across all bars, flip rate and the size of the move correlated -0.27. The median bar flipped side on 10.9% of its trades.

The longest run in a typical bar was 342 trades in a row on one side, and the longest in May 5,482.

How to read it

A run is a streak of consecutive trades on the same side. buy_run_max_len and sell_run_max_len are the longest streaks in the bar, the _mean_len fields their averages.

flip_rate is the share of trades that switched side from the one before. Near 1, buys and sells alternate. Low means one side kept trading.

run_imbalance compares buy runs with sell runs, from -1 to 1. price_change_on_flip is the average price move when the side flipped.

buy_run_max_len
Longest consecutive run of buy-side trades
sell_run_max_len
Longest consecutive run of sell-side trades
buy_run_mean_len
Average length of consecutive buy-side runs
sell_run_mean_len
Average length of consecutive sell-side runs
run_imbalance
Normalized difference between the longest buy run and longest sell run
flip_rate
Share of trades whose side flipped versus the previous trade
price_change_on_flip
Average absolute price change when trade direction flips
The research behind itHide the research

Here's a microstructure concept that rarely gets discussed outside market-making desks: trade runs — consecutive sequences of same-direction trades. Their statistical properties reveal the hidden structure of order flow in ways that aggregate volume metrics completely miss.

The theoretical basis

Lillo & Farmer (2004) made a striking empirical discovery: order flow in equity markets exhibits long-range autocorrelation, with a Hurst exponent significantly above 0.5. Buys tend to follow buys, and sells follow sells, at horizons far longer than can be explained by individual order splitting. They attributed this to the herding behavior of institutional investors and the mechanical persistence of algorithmic execution.

Earlier, Hasbrouck (1991) showed that the autocorrelation structure of trade signs (buy/sell sequences) carries information about the permanent price impact of trades. Trades that cluster into runs tend to have higher permanent impact than isolated trades — because runs are the signature of informed order flow that the market hasn't yet fully absorbed.

Bouchaud et al. (2004) formalized this in their propagator model, showing that the long memory of order flow, combined with a power-law decay in individual trade impact, produces a market that is approximately efficient despite highly predictable order flow.

What we measure

  • Maximum run length (buy/sell separately) — the longest uninterrupted same-direction streak. Long runs signal sustained directional pressure — either a large order executing incrementally or multiple participants leaning the same way.
  • Mean run length — average persistence before a direction flip. Higher means more serial correlation in the tape.
  • Run imbalance ratio — (max_buy_run − max_sell_run) / (max_buy_run + max_sell_run). Captures asymmetry in directional persistence.
  • Flip rate — fraction of trades that change direction. High flip rate = choppy, mean-reverting tape. Low flip rate = persistent flow.
  • Price change on direction flip — how much price moves when a run ends. Large price changes on flips indicate that runs represent genuine information being incorporated; small changes suggest noise.

Practical implications

The flip rate is directly related to the Roll (1984) model of the bid-ask bounce: in a pure noise-trading world with constant spreads, every trade should alternate between bid and ask, producing a flip rate near 1.0 and negative first-order return autocorrelation exactly equal to the squared half-spread. Deviations from this benchmark — particularly low flip rates — indicate that something beyond the mechanical bid-ask bounce is driving the tape.

Run imbalance is particularly powerful: if buy runs average 8 trades but sell runs average 3, buyers are sustaining pressure longer. This asymmetry often precedes continued price movement — it's the microstructure expression of the order flow autocorrelation that Lillo & Farmer documented at daily horizons, compressed into intrabar timescales.


References:

  • Lillo, F. & Farmer, J.D. (2004). "The Long Memory of the Efficient Market." Studies in Nonlinear Dynamics & Econometrics, 8(3).
  • Hasbrouck, J. (1991). "Measuring the Information Content of Stock Trades." Journal of Finance, 46(1), 179–207.
  • Bouchaud, J.-P., Gefen, Y., Potters, M. & Wyart, M. (2004). "Fluctuations and Response in Financial Markets: The Subtle Nature of 'Random' Price Changes." Quantitative Finance, 4(2), 176–190.
  • Roll, R. (1984). "A Simple Implicit Measure of the Effective Bid–Ask Spread in an Efficient Market." Journal of Finance, 39(4), 1127–1139.

Download the same month

No account needed. Pro adds every venue and perp, at 1-minute to daily bars.
# Install the Aperiodic CLI into ~/.local/bin
mkdir -p "$HOME/.local/bin"
curl -fsSL https://raw.githubusercontent.com/aperiodic-io/cli/main/install.sh | INSTALL_DIR="$HOME/.local/bin" bash
export PATH="$HOME/.local/bin:$PATH"

# Free preview — no API key required
aperiodic run_structure --preview \
  --exchange binance-futures \
  --symbol perpetual-BTC-USDT:USDT \
  --interval 5m \
  --timestamp exchange \
  --start-date 2025-05-01 \
  --end-date 2025-05-31 \
  --output-dir ./data && echo "Saved to $PWD/data"

Questions

Related

FlowTaker buys against sells, by size, with toxicityUp / down ticksTrades that moved the price up, down, or notImpactKyle's lambda, Amihud, and what size costs
Aperiodic

Built from hundreds of terabytes of raw data and distilled into point-in-time metrics you can pull as parquet files. Plus the raw trades, quotes and derivatives data behind them.

Use Cases
  • Improve your backtest
  • Find new alpha
  • Execute smarter
Indices
  • All indices
  • Aperiodic Cost Index
  • Aperiodic Depth Index
  • Aperiodic Impact Index
Metrics
  • Metrics library
  • Data Catalog
  • Live markets dashboard
  • Global Liquidity
  • Unusual activity
  • Order Flow
  • L1 & L2
  • Derivatives
  • RWA
  • Raw Data
Developers
  • API Docs
  • Live WebSocket Feed
  • MCP Server
  • Notebooks
  • For AI Agents
  • Atlas Security Master
  • Pre-flight
  • Changelog
  • Roadmap
  • llms.txt
Learn
  • Replays
  • Microstructure Guide
  • Architecture
  • Research Blog
  • FAQ
Compare
  • All vendors
  • vs. Tardis
  • vs. CoinGlass
  • vs. Kaiko
  • vs. Amberdata
Company
  • Pricing
  • Contact
  • Book a call
  • Terms of Service
  • Privacy Policy
  • Licensing
  • SLA

© Copyright 2026 Aperiodic. All Rights Reserved.

Aperiodic Limited · Registered in Ireland · Company No. 815273 ·
136 Capel Street, Dublin D01 T2C9, Ireland

Shown: minute closes of 847 perpetuals, 20:30–22:30 UTC on 10 Oct 2025, IOTX in orange · built with ohlcv 1m