Reference · Liquidity and Market Data
Market Data Snapshots and Deltas: Keeping State Consistent
Rebuild an illustrative market-data state from a snapshot and ordered updates, with gap detection, deletion handling and recovery checks explained.
Published Updated
Published by FxTrusts, a supplier of brokerage and prop firm technology. Prepared with AI-assisted research and drafting; reviewed against the cited public sources. Examples are illustrative. Product links describe our services.
Quick answer
A snapshot describes a complete state at a defined point. A delta describes a change that must be applied to the correct prior state. Reconstructing a book from deltas requires the source’s identifiers, ordering and update semantics; a missed or misapplied change can leave a plausible but wrong display.

Establish the starting state
A consumer needs a known baseline before applying updates that depend on previous values. Record the snapshot’s instrument, scope, identifiers and any sequence marker supplied by the feed. A snapshot may cover a fixed number of levels rather than an entire market. Do not interpret absent levels as nonexistent liquidity outside that scope. cTrader’s FIX specification documents snapshots and incremental messages for its own dialect. Its incremental actions use new and delete; the replacement-quantity example below is a deliberately different synthetic state model. Each feed’s agreed specification controls the exact fields and actions.
Distinguish replacement from addition
An update saying quantity 30 can mean replace the current quantity with 30, not add 30. A deletion can refer to an entry identifier, price level or another defined key. Applying the wrong interpretation can inflate depth or retain a removed quote. Document update actions and identifier lifetime before writing a transformation. The same warning applies when moving between a source that identifies individual entries and a destination that groups by price.
Treat a gap as an uncertainty in state
A missing update is not necessarily harmless because later messages still arrive. If the absent message removed a level, subsequent changes elsewhere will leave that obsolete level visible. Detect gaps using the feed’s supported ordering or recovery mechanism. Some feeds offer sequence numbers, while others require a different consistency check. Do not invent a universal one-step sequence rule; follow the documented stream semantics and invalidate uncertain state when required.
Reconcile recovery and concurrent updates
A new snapshot can race with updates received while it is being obtained. The consumer needs a documented boundary for discarding, buffering or applying those updates. Mixing an old delta with a newer snapshot can recreate an already removed value. A test should deliberately interrupt the stream, introduce a gap and verify recovery against an authoritative state. The separate FIX resubscription page addresses session-specific handling; this reference owns the underlying state model.
A missed deletion leaves a false quote
Assume a synthetic feed uses full replacement quantities and sequential event numbers. Snapshot 100 contains ask A at 10.00 for 20 units and ask B at 10.02 for 40. Event 101 replaces A with 15 units; event 102 deletes A; event 103 changes B to 30. A consumer missing event 102 incorrectly retains A. Receiving event 103 does not repair that error.
| State/event | Correct result |
|---|---|
| Snapshot 100 | A: 20 units; B: 40 units |
| 101: replace A quantity with 15 | A: 15; B: 40 |
| 102: delete A | B: 40 only |
| 103: replace B quantity with 30 | B: 30 only |
Implementation checklist
- Document snapshot scope, update keys and action semantics.
- Test replacement, deletion and reused identifiers explicitly.
- Detect gaps according to the actual feed protocol.
- Verify the snapshot/update boundary during recovery and reject uncertain state.
Sources
These documents support the reference. Check the original publication for current requirements and the limits of its scope.
- cTrader FIX API specification: platform-specific market datahelp.ctrader.com
- MetaTrader 5 depth of marketwww.metatrader5.com
Continue with the broader guides
Connect this reference to platform selection and the wider operating workflow.
