Roll Model Market Maker — Patch Update
Audit / Issue Found
When the strategy fired a scratch exit, it booked the trade twice. Once when it sent the market sell, and again on the next cycle when the existing balance-drop detector observed the resulting drop in holdings. Trade count, win-loss record, and profit-and-loss for that single scratch were credited or debited two times each.
Before the patch
A scratch exit could push the win column up by two on a single profitable scratch, or the loss column up by two on a single unprofitable one. Realized profit-and-loss similarly absorbed the same trade twice into the running total. Limit fills via the post-only quotes were always counted correctly because they only went through the balance-drop detector; only scratch market sells suffered the double-count.
After the patch
The scratch path now tags its cycle with the exact quantity it sold. The balance-drop detector subtracts the tagged quantity from the observed change before counting anything. Any spillover (for instance if a partial fill leaks into the next cycle) is still attributed correctly. The result is exactly one trade booked per scratch, with the correct profit-and-loss and win-loss adjustments.
Limit-fill bookkeeping is unchanged because it was already correct, and the external-fill attribution logic still warns when a drop in holdings has no matching strategy order.
Bottom line
Your trade counter and win-loss record now match reality for scratch exits, which means the running totals on the dashboard are reliable and the circuit-breaker that watches the loss streak is no longer being misled by phantom double-losses.
Follow-up correctness audit, same day
Two real issues were found and fixed.
First, the carry-over window between a scratch market exit and the balance-drop detector was only one cycle. If the scratch order takes more than one tick to clear on the exchange side, the leftover portion gets double-counted. The window is now five cycles by default, tunable per pair.
Second, a safety reaper was added so a tag that never matches a balance change cannot stay in memory forever and silently absorb future fills. If the scratch order is cancelled or the exchange never reports the drop, the tag is dropped and a warning is emitted.
The side-panel value labelled Pair Exposure was reviewed and confirmed correct for this strategy because it runs on spot, where the formula was designed to work.