A consolidated feed carries an exchange timestamp, and the network reorders messages so a tick can arrive up to 800 ms after a tick with a later exchange time. You build one minute bars keyed on exchange time. Give the design that produces correct bars, and say what you emit for a tick that arrives 4 minutes late.

A consolidated feed carries an exchange timestamp, and the network reorders messages so a tick can arrive up to 800 ms after a tick with a later exchange time. You build one minute bars keyed on exchange time. Give the design that produces correct bars, and say what you emit for a tick that arrives 4 minutes late.

Approach: Separate event time from processing time, then decide how long a window stays open and what the pipeline publishes for anything arriving after it has closed.

Key the bar on event time, hold the window open until a watermark 2 seconds past the bar end, then emit, and route anything later than the allowed lateness into a correction record rather than into the closed bar. The watermark is the pipeline's claim that no tick with an earlier exchange time will still arrive, so 2 seconds covers the observed 800 ms of reordering with margin and costs 2 seconds of latency on every bar. Processing time windows are wrong here because the same trade lands in a different bar on a replay, and a backtest reading those bars is fitting the network rather than the market. A tick that arrives 4 minutes late is past the allowed lateness and its bar is already published. Emit a correction record carrying the bar key with the new open, high, low, close and volume, and make every consumer keyed on the bar so it overwrites. Dropping the tick silently makes the volume quietly wrong, and reopening a published bar in place leaves any consumer that already read it inconsistent. Monitor the correction rate, because a rising rate is the first sign the watermark is too tight.

Follow-up: How would you set the watermark automatically from the observed arrival delay distribution?

Key concepts: event time, watermark, allowed lateness, correction record.