Repository navigation
feat(trade): order book reducer and depth aggregation (#697, #698) - #817
Merged
IbrahimIjai merged 2 commits intoSep 26, 2026
Conversation
|
@dev-debbie-umoh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
@dev-debbie-umoh is attempting to deploy a commit to the Ijai's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #697
Closes #698
Closes #699
Closes #700
Pure, UI-independent modules under
apps/web/src/features/trade/lib/orderbook/. No visible behaviour change, so no changelog entry.book-reducer.ts: snapshot-plus-delta reducer over exactbigintatoms. Revision-contiguity model: buffers deltas during snapshot fetch and replays them, drops those already in the snapshot, ignores duplicate/stale revisions, removes levels on quantity zero, and on any revision hole enters agapstate withactionable: falseuntil a fresh snapshot reconciles.depth.ts: side-aware grouping (bids down, asks up), cumulative base/quote, spread, crossed/locked detection and visible-depth scales. Grouping is exact integer arithmetic (quantity and quote value conserved, no rounding), never mutates canonical levels, and spread is derived from canonical prices rather than buckets.Test evidence
vitest run src/features/trade/lib/orderbook: 36 tests pass (reducer replay incl. snapshot handoff, out-of-order/duplicate, quantity-zero removal, gaps; depth incl. one-sided, empty, crossed, regrouping, no mutation). New files pass eslint and prettier and add notscerrors.Honest gate report (AGENTS.md)
I did not run a passing full commit gate;
mainalready fails several steps in files this PR does not touch:bun lint: 78 existing errors on a cleanmain(84 with my changes before autofix; my files are lint-clean).bun typecheck: 7 errors inuseOrderEventPolling.ts.bun run check:tokens: 5 violations in existing files.bun run test: 9 failures inpackages/uitoast.test.tsx.test:coveragecould not run locally (@vitest/coverage-v8failed to install; disk was full), so the 90% threshold is unmeasured.buildand the indexer integration checks were not run.Not covered: OB-047/OB-048 (indexer fill data, snapshot/history endpoints) are blocked on unverified upstream depth/fill sources (OB-041/OB-043 still open; see
docs/order-book-execution-model.md).