incremental_book_L2
incremental_book_L2
Family incremental_book_L2 · Since contract 2.2.0 · Rows per fact many
Key incremental_book_L2/{exchange}/{yyyy-MM-dd}/{encoded_symbol}.{sha12}.csv.gz
incremental_book_L2: exchange_seq,is_snapshot,row_reason,side,price,amount. The whole
book, as rows a reader can rebuild it from: one row per price level per book fact. side is
bid or ask. is_snapshot is true on a row of a whole-book group and false on a row
that changes one level. row_reason says why a row is there when no delta on the stream
carried it, and is empty when one did. Rebuilding a book has the rule
and what each value means.
Columns
Every family begins with the same 9 columns, in this order; the family’s own follow them.
A file’s first lines
The second line is a row’s shape, read off the contract: <decimal> stands for a value of that type, an enum shows its values, and a cell that may be empty is marked in the table above.
Emission
One row per price level per book fact the fold applied; the rows of one fact share its global_sequence and are contiguous. A delta writes the levels it carried, in its order, is_snapshot=false and row_reason empty; an amount of zero removes the level. A delta the fold ignored writes nothing. A restatement writes the whole book, is_snapshot=true and row_reason=restated, asks ascending then bids descending, when the book was not synced before it or it changes a level or a scale; one that leaves a synced book exactly as it was writes nothing. Checkpoint: unless the first fact of the hour applied to a book is a restatement written whole, the book as it stood before that fact is written whole first, is_snapshot=true and row_reason=checkpoint, under that fact’s clocks and global_sequence and the book’s own exchange_seq. Window: after a delta’s own rows, every level a depth window dropped is a removal with row_reason=window. A whole-book group for a book with no levels is one row with empty side, price and amount.
Rebuilding a book
A reader of incremental_book_L2 applies its rows a run at a time. This is the whole rule, as
the contract states it
under the family’s rebuild:
It needs no sequence chaining, no checksum, no depth rule for any venue and no rule for matching
one row’s price to another’s. From one whole-book group to the next every row of a book is at
one pair of scales, so a level has one spelling: a reader that keys on the text of the price
cell and one that keys on its value hold the same book. A zero amount is written at the
book’s scale like any other, 0 or 0.000. The rule never reads row_reason.
Three lines of it are where a reader ported from another format goes wrong:
- “If the run’s
is_snapshotis true: forget that book.” Every whole-book group starts its book afresh, also one that follows another with no delta between them: a run ends whereglobal_sequencechanges, not only whereis_snapshotdoes. A checkpoint followed by a restatement that changes the book, and two re-anchors of a quiet book, are neighbours of this kind. A reader that discards its book only whenis_snapshotturns true after false keeps levels the second group dropped. - “Keep one book for each
instrument_id.” A file is one symbol’s, and a symbol is almost always one instrument. Where a successor instrument takes a symbol over, the delisted instrument keeps the name for the rest of that hour, so rows of both can sit in one file, each with its owninstrument_idand its own whole-book groups. - “For each row of the run that has a side.” A row with no
sideis the one row of a whole-book group for a book that holds no level: its run forgets the book and sets nothing.
Where the book holds. The book the rule builds is the published book from that book’s first
whole-book group on. It stops being so at the start of any gap that covers the family, a
book_unsynced gap of it or a gap whose family is * (connector_disconnected), and at any
hour that is failed or absent: a failed hour has no files and, in its own manifest, no gaps,
and the day manifest lists it as a * gap over the hour. From there the book is unknown until
its next whole-book group, so a reader carries a book only from one ok hour into the next.
Past a failed hour in a day file that group can lie well into the next hour: it is that hour’s
checkpoint, and so also the book from that hour’s start.
What the rows are:
- A delta that applied to the book writes the levels it carried, in the order it carried
them:
is_snapshot=false,row_reasonempty. The rows of one fact share itsglobal_sequenceand its clocks, and sit together. A delta with no level writes no row. restated: the stream restated the whole book, and the book was unknown before it or the restatement changed it, in a level or in a scale. The rows are the whole book, asks ascending then bids descending. A restatement that leaves a known book exactly as it was writes nothing, so arestatedgroup always means that the book in front of you is not one its deltas had built. It stands for every change since the row before it: the separate updates inside, and their times, were never on the stream.checkpoint: the publisher’s own image, written once an hour and not a fact of the stream. Unless the first fact of the hour that applies to a book is arestatedgroup, the book as it stood before that fact is written whole first, under that fact’s clocks andglobal_sequenceand theexchange_seqthe book held. The fact’s own rows follow, which is why a run is split onis_snapshotas well. Nothing applied to the book between the hour’s start and that fact, so the checkpoint is also the book as the hour began; for an instrument first named inside the hour it is the book before its first named fact. Every hour file, and every hour of a day file, therefore opens each book on a whole-book group and rebuilds on its own. A reader that carried the book out of the hour before already holds the checkpoint: applying it changes nothing, and skipping it loses nothing.window: a removal the venue did not send. Some venues keep a fixed depth window and say nothing when a level slides out of it. The publisher writes each such level as a removal behind the delta’s own rows, in the delta’s group, so the rule above stays the whole of what a reader does. The level left the view; it may still stand in the venue’s book. A reader counting cancellations sets these rows aside. None of the three exchanges published today states a window.
A reader that wants only what the stream’s deltas said keeps the rows whose row_reason is
empty. exchange_seq is the venue’s sequence after the fact, or the sequence a checkpoint’s
book held; it is empty where the venue has none.
What the full-depth book can and cannot say, whatever the format:
- The depth is the subscribed channel’s, a connector setting for each venue. In production on 2026-11-11 the largest restated book held 100 levels over both sides on BYBIT and 800 on OKX.
- The BINANCE_SPOT book is its top 100 a side at each re-anchor, plus what has changed since. The stream is the venue’s diff channel over a 100-level snapshot. A level between the hundredth at the last anchor and the hundredth now is absent until it changes or the next anchor arrives, and what was learned beyond the hundredth is dropped at each anchor.
- It is price-aggregated depth at the venue’s cadence, 100 ms on BINANCE_SPOT and OKX. Nothing on the stream is order by order, so queue position is not observable.
- Each book is re-anchored about every five minutes on the three published exchanges, none
of which sends a checksum the connector can verify: the book is fetched or subscribed again,
and what changed meanwhile arrives as one
restatedgroup, not as deltas. The book is exact from that group on.
CSV is UTF-8 with LF endings and ordinary CSV quoting (quotes doubled inside quoted cells). An empty cell is null. The header is its own gzip member; bodies may contain multiple members because writer handles are bounded. Standard readers must consume concatenated gzip members. A day has exactly one header, followed by its hours’ headerless bodies.