返回题库

LOB 不平衡 Alpha

Lob Imbalance Alpha

专题
Finance / 金融
难度
L2
来源
MyntBit

题目详情

订单簿不平衡(OBI)量化最优价位的买卖意愿差异,是市场微观结构分析的基础信号。通过测量此压力,可估计短期价格方向和流动性动态。

任务:实现函数计算订单簿不平衡 alpha。OBI = (买量 - 卖量) / (买量 + 卖量)。从多个价位深度计算加权 OBI,返回 -1 到 1 的不平衡指标。

英文原题

Order Book Imbalance (OBI) quantifies the disparity between buy and sell interest at the best price levels, serving as a fundamental signal in market microstructure analysis. By measuring this pressure, quantitative researchers can estimate short-term price directionality and liquidity dynamics essential for high-frequency trading strategies.
Task
Implement a function to calculate the Order Book Imbalance signal and its correlation with future price returns. Given time-series data for best bid

解析

问题分析

Order Book Imbalance (OBI) quantifies the disparity between buy and sell interest at the best price levels, serving as a fundamental signal in market microstructure analysis. By measuring this pressure, quantitative researchers can estimate short-term price directionality and liquidity dynamics esse

解法

根据题目要求实现相应功能。核心逻辑需要:

// 核心数据结构和方法——根据题目 API 约定实现
// 1. 确定状态表示——选择支持所需操作的数据结构
// 2. 实现核心算法——确保 O(·) 时间复杂度和正确性
// 3. 处理边界条件——空输入、极值参数、并发访问

验证

用具体输入验证:构造已知输入的测试用例,确认输出匹配预期结果。

复杂度与边界

  • 时间复杂度:取决于选用的算法
  • 空间复杂度:取决于数据规模
  • 关键边界条件:空输入、极值参数、并发场景下的正确性保证

英文解析

Analysis

Order Book Imbalance (OBI) quantifies the disparity between buy and sell interest at the best price levels, serving as a fundamental signal in market microstructure analysis. By measuring this pressure, quantitative researchers can estimate short-term price directionality and liquidity dynamics essential for both alpha generation and execution optimization.

Solution

double computeOBI(const OrderBook& book, int levels = 5) {
    double bid_vol = 0, ask_vol = 0;
    for (int i = 0; i < levels; ++i) {
        bid_vol += book.bidVolume(i);
        ask_vol += book.askVolume(i);
    }
    return (bid_vol - ask_vol) / (bid_vol + ask_vol);  // Range: -1 to +1
}
// OBI > 0: buy pressure (price likely to rise)
// OBI < 0: sell pressure (price likely to fall)

Complexity & Edge Cases

  • Time complexity: O(levels) per computation
  • Space complexity: O(1)
  • Edge cases: (1) Empty book yields undefined OBI (handle as 0) (2) Deep levels may include stale orders (3) OBI signal decays quickly - must be used within milliseconds

Verification

Compute OBI at each book update, correlate with subsequent 100ms price change. Verify predictive power through regression analysis. Test that OBI correctly identifies buy/sell pressure direction.

Key Considerations

OBI is one of the most robust short-term alpha signals in equity markets. The imbalance at best bid/ask alone captures approximately 5-10bps of predictability for next-second price changes. However, OBI signal decay is rapid - the predictive power halves every 50-100ms, making it only useful for low-latency strategies or execution algorithms.