Latest Results
Fix remaining indicator rolling-window bugs (#4351)
* Fix SpreadAnalyzer panic when quotes exceed capacity
`SpreadAnalyzer` stored spreads in an unbounded `Vec`, whereas the Cython
reference uses `deque(maxlen=capacity)`. Once more than `capacity` quotes
were processed, `fast_mean_iterated` received a slice longer than the
expected length, returned an error, and panicked on `unwrap` — crashing
live trading on the (capacity + 1)th quote.
Bound the rolling window to `capacity` by evicting the oldest spread,
matching the Cython behavior. Add a regression test feeding more than
`capacity` quotes; the existing tests stopped at exactly `capacity`, so
the panic went uncaught.
* Fix EfficiencyRatio unbounded window and reset
`EfficiencyRatio` stored prices and deltas in unbounded `Vec`s, whereas the
Cython reference uses `deque(maxlen=period)` for both. After `period` updates
this diverged from Cython on every bar:
- `net_diff` used the all-time-first price instead of the price `period` bars
back.
- `sum_deltas` summed every delta ever seen instead of the last `period` (also
an unbounded memory leak).
`reset()` also cleared `inputs` but left `deltas` populated, so stale deltas
leaked into the next run.
Bound both windows to `period` and clear `deltas` on reset, matching the Cython
behavior. Since `AdaptiveMovingAverage` embeds this indicator, its Kaufman
efficiency input is corrected too. Add regression tests feeding more than
`period` inputs and exercising reset; the existing tests stopped at exactly
`period`, so the divergence went uncaught.
* Fix RelativeVolatilityIndex std rolling window
`RelativeVolatilityIndex` stored prices in a fixed-capacity 1024-element
`ArrayDeque`, whereas the Cython reference uses `deque(maxlen=period)`. The
standard deviation was therefore computed over up to 1024 observations while
the mean came from the `period`-window SMA, diverging from Cython on every bar
once more than `period` prices were seen.
Bound the price window to `period`, matching Cython. Add a regression test
feeding more than `period` inputs; the existing tests stayed within the
buffer's growth range, so the divergence went uncaught.
* Fix FuzzyCandlesticks unbounded rolling windows
`FuzzyCandlesticks` stored candle lengths, body percents, and upper/lower wick
percents in four fixed-capacity 1024-element `ArrayDeque`s, whereas the Cython
reference uses `deque(maxlen=period)` for each. Once more than `period` candles
were processed, the means (`sum / period`) summed the entire buffer and the
standard deviations divided by the full buffer length, so every fuzzy
size/body/wick classification used statistics over far more than `period`
candles.
Bound all four windows to `period` by evicting the oldest entry, matching
Cython. Add a regression test feeding more than `period` candles; the existing
tests stayed within `period`, so the divergence went uncaught.
* Fix SpreadAnalyzer average freezing at capacity
Once the rolling window reaches `capacity`, the incremental
`fast_mean_iterated(..., drop_left=false)` update subtracts
`values[length - 1]` (the spread just pushed) instead of the evicted
oldest value, so the running average stops changing for non-constant
spreads. The Cython reference shares this quirk; the all-constant
regression test hid it.
Recompute the average from the bounded window after eviction, which is
O(capacity) given the existing `Vec::remove(0)` and always correct. Add
a regression with monotonically increasing spreads past capacity, and
update the constant-spread baked value to the recomputed float. Latest Branches
-1%
-45%
-42%
Pushkarm029:order_emulator © 2026 CodSpeed Technology