Article
Replay a simulated order from its event history
A small paper-trading fixture can show exactly when a simulated order became active, partially filled and complete.
Write a fixture with a known outcome
Use an invented instrument called DEMO and a simulated order for ten units. Record a submission, an acknowledgement, a fill of four units and a fill of six. Give each fill a distinct identifier. Write down the expected remaining quantity after each step. Keep this fixture local so the exercise is repeatable even when a provider sandbox is unavailable.
Keep the observations that explain the result
Store the event type, provider timestamp, local arrival time, order reference and fill identifier when available. Preserve the incoming events in arrival order so that a replay can reproduce what the bot actually saw. Track the cumulative filled quantity using unique executions. A duplicate notification about the four-unit fill should leave both the total and the order's remaining quantity unchanged.
Reorder the replay
Run the fixture again with a duplicate fill and with the acknowledgement arriving late. Verify the final cumulative quantity and ensure a late acknowledgement cannot reopen an already completed order. Try an unexpected fill reference too. Keep that case visible for reconciliation with the simulated provider's history. The output should identify the first event at which the recorded state diverges, which makes a connector issue easier to diagnose.