aura-ingest: canonical OHLC opener — one call for the 4 M1FieldSources in C4 merge order #92

Closed
opened 2026-06-17 18:16:55 +02:00 by Brummel · 1 comment
Owner

Surfaced building the GER40 real-data example (commit 5b5f034,
crates/aura-ingest/examples/ger40_breakout_real.rs).

Opening a real OHLC stream for a strategy means calling
M1FieldSource::open(server, symbol, from, to, field) four times by
hand
— once per M1Field::{Open, High, Low, Close} — each repeating the
same symbol + window, and assembling them into a Vec<Box<dyn Source>>.

The load-bearing part is the source order: open, high, low, close. That
order is the C4 merge tie-break the resampler's Firing::Barrier(0) group
depends on (Resample's four inputs are fed in declaration order). Spelling it
out by hand four times makes it implicit and easy to get wrong — a silent
wrong-field-into-wrong-slot bug class, not a compile error.

The example had to encode this in a local open_ohlc_sources helper
(examples/shared/breakout_real.rs). Every real-OHLC consumer will
re-write the same helper.

Proposed: ship the canonical opener in aura-ingest, e.g. an
open_ohlc(server, symbol, from_ms, to_ms) -> Option<[Box<dyn Source>; 4]>
returning the four sources in canonical open, high, low, close order — so the
merge order lives in one vetted place and the trap is removed. Non-blocking —
the example works around it today.

**Surfaced building the GER40 real-data example** (commit `5b5f034`, `crates/aura-ingest/examples/ger40_breakout_real.rs`). Opening a real OHLC stream for a strategy means calling `M1FieldSource::open(server, symbol, from, to, field)` **four times by hand** — once per `M1Field::{Open, High, Low, Close}` — each repeating the same `symbol` + window, and assembling them into a `Vec<Box<dyn Source>>`. The load-bearing part is the **source order**: open, high, low, close. That order is the C4 merge tie-break the resampler's `Firing::Barrier(0)` group depends on (Resample's four inputs are fed in declaration order). Spelling it out by hand four times makes it implicit and easy to get wrong — a silent wrong-field-into-wrong-slot bug class, not a compile error. The example had to encode this in a local `open_ohlc_sources` helper (`examples/shared/breakout_real.rs`). Every real-OHLC consumer will re-write the same helper. **Proposed:** ship the canonical opener in `aura-ingest`, e.g. an `open_ohlc(server, symbol, from_ms, to_ms) -> Option<[Box<dyn Source>; 4]>` returning the four sources in canonical open, high, low, close order — so the merge order lives in one vetted place and the trap is removed. Non-blocking — the example works around it today.
Brummel added the idea label 2026-06-17 18:16:55 +02:00
Brummel added this to the Runway — real-data ergonomics & honesty hardening milestone 2026-06-18 11:02:34 +02:00
Author
Owner

Shipped in 8c9a1b4, in main since cycle 0052; auto-close fired only for #80 (same un-fired 'closes' as #81). Verified at HEAD: open_ohlc(server, symbol, from, to) (lib.rs:321) opens the four M1FieldSources in fixed open/high/low/close C4 merge order — the single vetted home of the tie-break — guarded by tests/open_ohlc_seam.rs (bit-identical to four hand-opened sources). The old hand-rolled open_ohlc_sources helper is gone; all consumers call the canonical opener. One deviation from the issue's literal proposal: shipped return type is Option<Vec<Box>> not [_;4] (Harness::run consumes Vec; order-safety comes from the single helper either way). Closing as done.

Shipped in 8c9a1b4, in main since cycle 0052; auto-close fired only for #80 (same un-fired 'closes' as #81). Verified at HEAD: open_ohlc(server, symbol, from, to) (lib.rs:321) opens the four M1FieldSources in fixed open/high/low/close C4 merge order — the single vetted home of the tie-break — guarded by tests/open_ohlc_seam.rs (bit-identical to four hand-opened sources). The old hand-rolled open_ohlc_sources helper is gone; all consumers call the canonical opener. One deviation from the issue's literal proposal: shipped return type is Option<Vec<Box<dyn Source>>> not [_;4] (Harness::run consumes Vec; order-safety comes from the single helper either way). Closing as done.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Brummel/Aura#92