Order Flow Imbalance
Short-term price movements in financial markets are heavily influenced by order flow, not just historical price patterns.
One useful microstructure metric used in quantitative trading is Order Flow Imbalance (OFI).
Order Flow Imbalance measures the difference between aggressive buying and selling pressure within a time interval.
[ OFI_t = BuyVolume_t - SellVolume_t ]
Where:
- BuyVolume = executed market buy orders
- SellVolume = executed market sell orders
Positive imbalance suggests buy-side pressure, while negative imbalance suggests sell-side pressure.
Microstructure Interpretation
Markets move when liquidity on one side of the order book is consumed.
Example order book snapshot:
| Price | Bid Size | Ask Size |
|---|---|---|
| 42000 | 10 BTC | |
| 42010 | 7 BTC |
If aggressive buyers absorb the 7 BTC ask liquidity, the next available ask becomes higher, causing the price to move upward.
In simplified form: Buy Pressure > Available Sell Liquidity → Price Increase Sell Pressure > Available Buy Liquidity → Price Decrease
Order Flow Imbalance quantifies this process.
Example
Consider the following trades over a short interval:
| Trade | Volume | Side |
|---|---|---|
| 1 | 3 BTC | Buy |
| 2 | 2 BTC | Buy |
| 3 | 1 BTC | Sell |
| 4 | 4 BTC | Buy |
Then:
[ OFI = (3 + 2 + 4) - 1 = 8 ]
This indicates a strong buy-side imbalance.
Simple Python Example
```python import pandas as pd
data = { “volume”:[3,2,1,4], “side”:[“buy”,”buy”,”sell”,”buy”] }
df = pd.DataFrame(data)
buy_volume = df[df.side==”buy”][“volume”].sum() sell_volume = df[df.side==”sell”][“volume”].sum()
ofi = buy_volume - sell_volume
print(“Order Flow Imbalance:”, ofi) Practical Applications
Order Flow Imbalance is commonly used in:
High-frequency trading models
short-term alpha generation
liquidity imbalance detection
market microstructure analysis
Combined with volatility and liquidity metrics, OFI can provide useful signals for short-horizon price prediction.
Final Thought
Price charts show the result of trading activity, but order flow reveals the underlying pressure driving the market.
Understanding order flow imbalance provides a deeper view of how markets actually move.