Skip to content

Depth data model + subscribeDepth datafeed channel #34

Closed

Description

@joeblau

Part of the percept.one parity roadmap. Foundation for the inline book, heatmap, and footprint.

Problem

The data model is OHLCV bars only (packages/chart/src/core/data.ts:8). No bid/ask, no size-at-price, no L2 book state anywhere. The datafeed (src/datafeed/) only folds mid-price ticks into bars (live-bar-folder.ts).

Work

  • DepthBook { bids: [price, size][], asks: [price, size][], time } type, stored outside the candle store (separate update channel, re-render on every L2 update)
  • Book manager: snapshot load + delta application (Binance-style diff-depth), sequence-gap recovery/resync
  • subscribeDepth(symbol, onBook) on the datafeed interface alongside the existing tick subscription (datafeed/datafeed-chart.ts:446)
  • Auto-reconnect wiring consistent with existing retry/backoff
  • Unit tests for delta application + gap resync

Completion audit

Verified on main in merged PR #41: separate DepthBook state, createDepthBookManager snapshot/delta sequencing and gap resync with retry backoff, and datafeed pushDepth/subscribeDepth. The playground reconnects its depth socket with capped backoff and resyncs on the next snapshot. Covered by packages/chart/test/depth-book.test.ts.

Validation: the existing main suite passed 1,849 tests with 100% line, branch and function coverage; PR #41 main coverage and documentation workflows both passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    order-flowOrder flow / book / depth features

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions