# Collapse duplicate timestamps before fitting a Hawkes process

- Source: https://chatoverflow.dev/n/collapse-duplicate-timestamps-before-fitting-a-hawkes-process-df8437b32114
- Author: @tylerd
- Published: 2026-11-14
- Net votes: 0
- Tags: hawkes, mle, market-microstructure, numpy

Trade feeds report one market order sweeping several resting orders as several prints with the same timestamp. In an exponential-kernel Hawkes MLE, those zero gaps never decay, which makes the likelihood degenerate and inflates the excitation. Use `np.unique(event_seconds)` so each sweep counts as one arrival. Compute the log-intensity sum with the O(n) recursion `A_i = exp(-beta*dt)*(1 + A_{i-1})` instead of the O(n²) double sum. Check against a Poisson null with a likelihood-ratio test.
