← Changelog

Hawkes Process Market Maker — Patch Update

Patch7 June 2026· per-strategy

Audit / Issue Found

The strategy had no detector for normal limit-fill activity. The only time it would increment the trade counter, profit-and-loss total, or win-loss record was when it tripped the stop-loss. Every other fill, including every successful spread capture from the post-only quotes that the strategy is built to earn, went uncounted.

Before the patch

You could run this strategy for a week earning thousands of dollars of maker spread, and the stats panel would show zero trades, zero wins, zero profit-and-loss. The Hawkes intensity model and the spread widening logic worked fine, but the bookkeeping was effectively switched off for everything except emergency exits. Any performance dashboard, win-rate calculation, or circuit-breaker that depended on those numbers was operating on bad data.

After the patch

Added a real fill detector that watches the actual balance on the exchange. Every time the bot's holding of the traded asset changes by more than dust, the detector confirms a fill, calculates the realized profit-and-loss from the cost basis, and updates the trade count, profit total, and win-loss record accordingly. A safety guard ignores giant jumps caused by deposits, withdrawals, or data glitches so those do not pollute the stats.

The stop-loss path still books its own fill immediately so profit-and-loss is never lost if the exchange clears the position before the next cycle. The new detector cross-references a per-cycle tag with the exact size sold, so the stop-loss fill is never counted twice.

Bottom line

You can now actually see what this strategy is doing. Trade count goes up when it fills. Profit and loss matches what the exchange shows. Wins and losses correctly reflect spread capture vs adverse selection, which means the circuit-breaker that pauses trading on a losing streak now reacts to real losses instead of staying silent.

Follow-up correctness audit, same day

Three improvements to the new fill detector were applied after a deeper review.

First, the carry-over window from a stop-loss to the detector was only one cycle. On illiquid pairs or congested exchanges, a market sell can take a few ticks to fully settle on the exchange side. With the old single-cycle window, any leftover fill on the second or third cycle was treated as a brand-new sell and double-counted. The window is now five cycles by default, tunable per pair, so stragglers get matched and only genuinely new fills get counted.

Second, a safety reaper was added. If the stop-loss qty is somehow never matched by an observed balance drop, for example if the order was cancelled or the exchange never reported the corresponding drop, the carry-over would have lived forever and silently swallowed every future sell. The reaper drops the tag after the window expires and warns about the unmatched quantity, so the bookkeeping cannot get stuck in a quiet wrong state.

Third, recovery from a breakeven glitch was hardened. The detector skips its work if the exchange momentarily reports zero breakeven while you are holding inventory. The previous version left the stored previous state untouched during the glitch, so when the data healed on a later cycle the detector compared current state against a stale baseline and produced corrupted realized profit. The fix resets the baseline at the start of the next valid cycle, sacrificing the silent fills during the glitch but preventing a corrupted recovery.

One other finding was checked and confirmed as a cosmetic concern in pre-existing code, with no impact.