Questions / Quant development, Streaming market data

Recover a book after a gap

Applied, about 6 minutes. Question D028.

A book snapshot is valid through sequence 100. Deltas 101 and 103 arrive, but 102 is missing. What is a sound response for a feed requiring contiguous updates?

  1. ADetect the missing sequence and recover before declaring completeness.
  2. BApply 103 because the sequence increased.
  3. CApply 103 and use its higher sequence as evidence of a complete book.
  4. DApply 103 after a short wait and treat 102 as skipped.

Answer it in the app It's free. You get hints, a second try if you miss, and a follow-up question.

Show the answer and worked solution

Answer: A. Detect the missing sequence and recover before declaring completeness.

  1. After snapshot 100, delta 101 can advance the state to 101. Receiving 103 reveals that update 102 has not been applied.
  2. The missing update may affect prices or quantities. Use the feed's recovery or resnapshot protocol before claiming state complete through 103.

Interview shortcut. A sequence gap means the book is unknown: recover.

Takeaway. A book requires contiguous state transitions, not just increasing labels.

Why the other choices fail

  • Apply 103 because the sequence increased. Increasing sequence numbers establish order among received messages, not the absence of messages between them.
  • Apply 103 and use its higher sequence as evidence of a complete book. The latest sequence number identifies a point in the stream, but does not establish that every earlier update was applied.
  • Apply 103 after a short wait and treat 102 as skipped. Waiting without recovering still leaves 102 missing.

In the app this has a follow-up where one thing about the setup changes. Try the follow-up.

More streaming market data questions