OPEN SOURCE · UPSTREAM CONTRIBUTION
NautilusTrader
Correctness and performance work around the Rust-native Aroon oscillator in an open-source, production-grade multi-asset trading engine.
What NautilusTrader is
NautilusTrader is an open-source, production-grade, Rust-native engine for multi-asset and multi-venue trading systems. It combines research, deterministic simulation and live execution in one event-driven architecture, with Python serving as a control plane for strategy logic, configuration and orchestration.
Contribution trail
Two issue-level contributions around the same indicator, with the correctness fix now merged upstream.
3 items
merge Merged PR
#5037 · merged 21 Sep 2026
Fix AroonOscillator MAX_PERIOD window capacity
ExcerptThe public maximum period is 1,024, while Aroon requires a period + 1 observation window. The patch increases the high and low buffer capacity to 1,025 so the implementation can retain the full boundary window instead of silently dropping the oldest observation.
The PR adds mirrored Rust and Python regression coverage for exact initialization at MAX_PERIOD + 1, retention of the oldest unique high and low, correct Aroon values at the boundary, and rollover on the following observation. The merged change touched 2 files across 3 commits with +139 / -2 lines.
RustPythonCorrectnessRegression coverageAroonOscillator
check_circle Issue · completed
#4995 · fixed by #5037
AroonOscillator accepts MAX_PERIOD but cannot retain its required period + 1 window
ExcerptAt the accepted maximum period, the oscillator needed 1,025 highs and lows but its wrapping deques could only hold 1,024. Pushing the next observation could evict the oldest value before calculation, so the implementation's storage invariant and public constructor contract disagreed.
The report reproduced the failure against the published v2.0.0rc5 pre-release and showed an observable signal error: the unique oldest high could be lost at the boundary, changing Aroon Up from the expected 0.0 to 100.0 and the oscillator value from -100.0 to 0.0.
Bug reportBoundary invariantRuntime reproduction
lightbulb Open RFC
#4996 · performance proposal
Consider amortized O(1) rolling extrema for AroonOscillator
ExcerptAfter initialization, every Aroon update currently rescans the full high window and the full low window. The RFC proposes maintaining monotonic deques so each observation enters and leaves once, moving the stream path from O(Np) toward O(N) while keeping storage at O(p).
The proposal explicitly preserves Aroon's current tie semantics where equal highs or lows resolve to the most recent occurrence, and recommends benchmarking representative periods before accepting the additional state and implementation complexity.
RFCAlgorithmsPerformanceMonotonic dequeO(1) amortized
Contribution approach
This contribution combines reproducible boundary-case investigation, a narrowly scoped correctness patch, cross-language regression coverage, and a separate performance proposal rather than mixing optimization into the bug fix.