最优报价处买单量与卖单量的对比,提供K线收盘值及K线内均值。
买卖失衡、比率与占比,均提供瞬时值(末值)及区间均值。
2025年5月14日14:00至14:05 UTC的5分钟K线,Binance BTC-USDT永续合约,数据来自免费预览。
步骤 1
imbalance_ratio 的取值范围为−1(买价一侧无挂单)至1(卖价一侧无挂单)。在该K线收盘时,买卖双方几乎持平。
步骤 2
最新报价值在K线之间跳动较大,而K线内各次更新的均值波动较小。每次更新只计一次,无论其持续多久。
步骤 3
均值为 56.3,尽管买方平均占 44.0% 的挂单量。少数几次更新中卖方几乎为空,使 bid / ask 变得极大,均值也随之被拉高。imbalance_ratio 的取值限定在−1与1之间,因此不存在这一问题。
步骤 4
Binance BTC-USDT永续合约,5分钟K线,2025年5月1日至31日,取自免费预览。
按盘口平均失衡度分组的K线,从卖单偏重到买单偏重. 个基点。
按平均失衡度对K线排序:卖单最偏重的十分之一平均下跌6.71 bps,买单最偏重的十分之一平均上涨6.50 bps。订单簿随行情同步倾斜。
对下一根K线而言,收盘时的取值表现优于均值(0.055对0.002),因为它是最新信息。但其噪声也更大:12%的K线中该值超出±0.9,即当时某一侧几乎为空。
imbalance 为最优报价处买单量减去卖单量。 imbalance_ratio 将其缩放至-1(全为卖单)到1(全为买单)之间。 bid_percentage and ask_percentage 分别为买卖双方各自的占比。
成交最活跃的前 _avg 字段为区间内所有报价更新的均值,每次更新计一次。不带前缀的字段为最后一次报价。在报价频繁撤换时,两者差异最大。
bid_ask_ratio 在某一侧几乎为空时会变得极大。请改用缩放至±1的比率。
从零讲解,详见 从第一性原理理解市场(我们的互动课程):
Order book imbalance is arguably the single most validated short-term predictive signal in the market microstructure literature. The intuition is immediate: if there's substantially more resting size on the bid than the ask, the next price move is more likely upward.
Cont, Kukanov & Stoikov (2014) provided the definitive empirical analysis, showing that order book imbalance — defined as:
predicts the direction of the next mid-price change with statistically and economically significant accuracy across multiple equity markets. The signal is monotonic: stronger imbalance produces larger expected price moves, and the relationship is approximately linear.
Their insight was that the imbalance captures the queue dynamics of the limit order book: when one side has substantially more depth, the probability that the opposite side is depleted first (triggering a price change toward the deeper side) increases mechanically.
A single snapshot of imbalance is noisy — market makers continuously refresh quotes, and a momentary asymmetry can be an artifact of staggered updates. Huang & Polak (2011) showed that time-averaged imbalance over longer windows provides a smoother, more predictive signal that captures the sustained directional tilt of the book rather than transient fluctuations.
We compute both:
The divergence between them — how much the closing snapshot differs from the average — itself carries information. A large divergence indicates recent quote instability, suggesting a potential regime change within the bar.
Top-of-book (L1) imbalance captures only the best bid and ask. But Cao, Chen & Griffin (2005) demonstrated that information about future price changes exists at deeper levels of the book. A thin top-of-book bid sitting in front of massive size at deeper levels is structurally different from a thin bid with nothing behind it.
We compute L2 imbalance at cumulative depth tiers: 5, 10, 20, and 25 price levels per side. This captures the full shape of supply-demand imbalance, not just the frontier.
The L1-L2 divergence is the most actionable signal. When L1 shows thin bids but L2 reveals deep bid-side support, the apparent weakness is a mirage — the top-of-book thinness is likely a market maker adjusting inventory, not a genuine absence of demand. Conversely, thick L1 bids with empty L2 behind them indicate a single concentrated quote — remove that one market maker and there's a price gap.
References:
# 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 l1_imbalance --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"所有交易所和永续合约,从1分钟到日线K线,均提供 Prime.
L1失衡 ,API文档中的说明:端点与参数 →