Contact Now
QuantApr 15, 2026

Deep Dive: Order Book Imbalance Signals

Extracting microstructural alpha from Level 2 data.

Microstructural Alpha

Order Flow Imbalance (OFI) is one of the few pure microstructural signals left in high-frequency trading that hasn't been completely arbitraged away by market makers.

We analyzed a massive Kaggle dataset containing 500-millisecond snapshots of the L2 order book. Most naive strategies only look at the top of the book (Best Bid / Best Ask). Instead, we trained a specialized LSTM network to process the depth of the book up to 10 levels deep on both sides.

The Signal

The network successfully identified "hidden" liquidity exhaustion events—moments where the bid side of the book looks full, but the deeper levels are rapidly being cancelled, indicating a spoofing event or an imminent price drop.

# Calculating naive Order Flow Imbalance (OFI) def calculate_ofi(bid_vol_t, bid_vol_t1, bid_price_t, bid_price_t1, ask_vol_t, ask_vol_t1, ask_price_t, ask_price_t1): # Logic to handle price changes vs volume changes at the top of book bid_change = bid_vol_t if bid_price_t > bid_price_t1 else (bid_vol_t - bid_vol_t1 if bid_price_t == bid_price_t1 else -bid_vol_t1) ask_change = ask_vol_t if ask_price_t < ask_price_t1 else (ask_vol_t - ask_vol_t1 if ask_price_t == ask_price_t1 else -ask_vol_t1) return bid_change - ask_change

The challenge? The predictive signal decays in less than 2 seconds. Deployment required writing a custom C++ execution engine that binds directly to the exchange API, bypassing the Python interpreter entirely.