aura-ingest: canonical OHLC opener — one call for the 4 M1FieldSources in C4 merge order #92
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 byhand — once per
M1Field::{Open, High, Low, Close}— each repeating thesame
symbol+ window, and assembling them into aVec<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)groupdepends 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_sourceshelper(
examples/shared/breakout_real.rs). Every real-OHLC consumer willre-write the same helper.
Proposed: ship the canonical opener in
aura-ingest, e.g. anopen_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.
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.