HawkEye
Advanced Market Microstructure Analytics
Created on 21st January 2026
•
HawkEye
Advanced Market Microstructure Analytics
The problem HawkEye solves
Traditional technical analysis treats all price moves as equal, but markets don't work that way.
A 1% move during calm conditions is fundamentally different from a 1% move during a crisis.
Most retail traders and even professional analysts miss the hidden structure beneath price movements:
- Shock Clustering - Volatility begets more volatility, but when will the next shock hit?
- Jump vs Diffusion - Is this a temporary noise or a fundamental regime shift?
- Information Asymmetry - Are informed traders active right now, or is it just noise?
VolatilityLens solves this by:
- Identifying self-exciting shock patterns using Hawkes processes (borrowed from earthquake prediction)
- Detecting statistical jumps (discontinuous price moves from news/large orders) vs normal diffusion
- Providing actionable intelligence: probability of next shock, jump contribution to volatility, regime identification
Instead of just saying "RSI is 70, market is overbought," it tells you:
- "RSI is 70 AND Hawkes intensity is elevated → High probability reversal in next 10-30 minutes"
- "Jump detected with 42% branching ratio → Expect 0.42 additional shocks from this event"
Challenges I ran into
1. VPIN Implementation Hell
Problem: Initial VPIN (Volume-synchronized Probability of Informed Trading) was stuck at 1.0
(100% toxic flow) - clearly wrong!
Root Cause:
- Used simple tick rule (price up = buy, down = sell) → Too binary
- Didn't account for zero price changes → Forward fill issues
- Volume bucket logic had off-by-one errors
Solution:
- Switched to Bulk Volume Classification (BVC) with Z-score methodology
- V_buy = V × Φ((ΔP)/σ) where Φ is normal CDF
- This gave realistic 50/50 buy/sell split instead of 100/0
Lesson: Read the actual academic papers (Easley et al. 2012), don't just implement
from blog posts!
2. Hawkes Process Optimization Instability
Problem: MLE optimization would randomly fail or return nonsensical parameters
(α/β > 10, persistence > 1.5)
Root Cause:
- Poor initial parameter guesses
- Log-likelihood function has local minima
- Compensator integral was numerically unstable for large T
Solution:
- Used L-BFGS-B with strict bounds: α, β, μ > 1e-6, α/β < 0.99
- Better initialization: μ = N/T (empirical rate), α = 0.05, β = 0.2
- Vectorized intensity calculation (avoided Python loops)
Code snippet that saved me:
# Compensator term - use numpy broadcasting
compensator = mu * T + (alpha/beta) * np.sum(1 - np.exp(-beta * (T - events)))
3. mplfinance Integration with Custom Indicators
Problem: mplfinance is powerful but opinionated - couldn't overlay Hawkes intensity
on candlestick charts
Challenges:
make_addplot()expects same index as OHLCV data- Can't mix scatter + line plots easily
- No built-in support for dual y-axes (price vs intensity)
Solution:
- Create shock points as separate series with NaN for non-shocks
- Use
type='scatter'in addplot for event markers - For complex layouts (RSI + Volume + Custom), fell back to matplotlib subplots
Workaround:
shock_points = chart_data['Close'].copy()
shock_points[chart_data['Hawkes_Shock'] == 0] = np.nan # Hide non-shocks
apds.append(mpf.make_addplot(shock_points, type='scatter', marker='v', color='red'))
Tracks Applied (1)
Quantifying the Markets - Machine Learning
Technologies used
