Hawkes Process: Order-Flow Dynamics Engine
View Repository SourceA multivariate linear Hawkes process engine with analytic gradients and exact Ogata-thinning, leading to a clean negative result on synthetic data.
I developed a multivariate linear Hawkes process engine designed for analyzing order-flow dynamics on seconds-to-minutes horizons, explicitly targeting execution alpha and adverse-selection timing rather than latency-race HFT.
Formal Analytics and Stability
The engine’s fully analytic, provably tractable core (Tier A) is specified in a formal mathematical spec, and every formula in it is checked numerically by a standalone verification script. I implemented:
- Exact Ogata-thinning simulations.
- A global concave log-likelihood with analytic gradients for fixed timescale banks.
- Spectral radius guards ($\rho(\Gamma) < 1$) to stringently enforce process stability.
Rigorous Backtesting
I engineered a purged and embargoed walk-forward backtest harness. This wasn’t a naive price-snapshot test; it featured queue-position-aware fill simulation complete with exchange rebates, realistic latency, and tick constraints. The integrity of the harness itself was verified using a hindsight-optimal oracle and random leakage controls.
The Honest Negative Result
After all this engineering, the system reached a clean negative result, on synthetic data. Out-of-sample expected forward moves ($\sim 0.0005$) were a full order of magnitude smaller than half-spread costs ($\sim 0.005$).
This showed that while the model had weak statistical predictability (a positive IC), the signal was economically unexploitable once transaction friction was counted. Testing on real order-flow data is the next step, and I would not claim the conclusion carries over until it is run.