Scenario
In high-frequency quantitative market making, the instantaneous order flow imbalance (OFI) measures net supply-demand pressures inside the Limit Order Book (LOB) across successive book states.
Your Task
- Given best bid price Ptb, best bid depth qtb, best ask price Pta, and best ask depth qta, formulate the event-by-event bid flow contribution etb and ask flow contribution eta.
- Define the total order flow imbalance OFIt=etb−eta.
- Derive the linear price impact regression parameter β=Var(OFIt)Cov(ΔPt,OFIt) for mid-price changes ΔPt=Ptmid−Pt−1mid.
- Simulate a series of 10 LOB events, compute the resulting OFI time series, and calculate the empirical price impact coefficient β.
Constraints
- Level 1 top-of-book quotes.
- Standard Cont-Kukanov-Stoikov (2014) OFI definitions.
Examples
When a buyer consumes the ask queue (price increases or ask size decreases), eta<0, making OFIt>0, predicting an upward mid-price movement.