Skip to content

Implement snapshot_delay support in marketdata config - #46

Merged
tuxmonteiro merged 1 commit into
mainfrom
feat/snapshot-delay-config
Aug 13, 2026
Merged

Implement snapshot_delay support in marketdata config#46
tuxmonteiro merged 1 commit into
mainfrom
feat/snapshot-delay-config

Conversation

@tuxmonteiro

Copy link
Copy Markdown
Contributor

Implement snapshot_delay support in marketdata config

cryptomeria-ingest v0.0.22 added a snapshot_delay field to its
DataSourceConfig (per ADR-026
— Bitstamp delta-buffering with snapshot merge, CCXT Pro pattern). This field
controls how many diff-order-book deltas to buffer before fetching a REST
snapshot (default 6; set to 0 to disable).

The marketdata project's to_data_source() was constructing a DataSourceConfig
literal without this field, causing a hard compile error (E0063). This PR adds
snapshot_delay as an instrument-level config field on InstrumentConfig,
forwards it in to_data_source(), and includes full TDD test coverage.

Changes

  • src/config.rs: Added default_snapshot_delay() -> usize { 6 } helper;
    added snapshot_delay: usize field to InstrumentConfig with
    #[serde(default = "default_snapshot_delay")]; replaced derived Default
    with a manual impl to keep the serde and Rust defaults consistent (both 6);
    forwarded the field in to_data_source(); added 3 unit tests.
  • config.toml.example: Documented snapshot_delay in the OKX, Kraken, and
    commented-out Bitstamp instrument sections.
  • AGENTS.md: Updated the per-instrument fields list to include snapshot_delay.
  • README.md: Added snapshot_delay to the config example.
  • docs/adr/Integration/ADR-015: New ADR documenting the decision.

Verification

  • cargo check — OK
  • cargo test — 79 passed, 0 failed (77 lib + 2 binary, including 3 new snapshot_delay tests)
  • cargo clippy --all-targets -- -W warnings — clean
  • cargo fmt --check — clean

Fixes #45

cryptomeria-ingest v0.0.22 added snapshot_delay to DataSourceConfig (ADR-026)
to support Bitstamp delta-buffering snapshot merge (CCXT Pro pattern).
This field was missing from to_data_source(), causing an E0063 compile error.

Add snapshot_delay: usize to InstrumentConfig with a serde default of 6
(mirroring the ingest library's default_snapshot_delay). Set to 0 to disable
delta buffering. Forward the field in to_data_source().

- src/config.rs: add default_snapshot_delay() helper, snapshot_delay field,
  manual Default impl, forwarding, and 3 TDD unit tests
- config.toml.example: document snapshot_delay in OKX/Kraken/Bitstamp sections
- AGENTS.md: update per-instrument fields list
- README.md: add snapshot_delay to config example
- docs/adr/Integration/ADR-015: document the decision
@tuxmonteiro
tuxmonteiro merged commit 075a909 into main Aug 13, 2026
2 checks passed
@tuxmonteiro
tuxmonteiro deleted the feat/snapshot-delay-config branch August 13, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement snapshot_delay support in marketdata config

1 participant