Expand description
Allocation-free, #![no_std] streaming technical indicators.
wickra-embed-core runs the Wickra indicator math where there is no operating
system and no heap — microcontrollers, FPGA soft-cores, HFT co-processors.
Every Indicator update is O(1) with a bounded worst case, keeps its state
inline in fixed-capacity buffers (no allocation), and produces the
byte-for-byte identical value the std wickra-core library produces on
a server.
§Design
- No heap. Windowed indicators store their history in a const-generic
Ringor a fixed array; nothing touches an allocator. The window length is the const parameterN(e.g.Sma<20>). - No panics in the update path. A panic on a microcontroller is a reset,
so the core never uses
unwrap/expect/unreachable!on the hot path; warmup and undefined states are expressed asNone. - Deterministic to the bit. The floating-point work is done in the exact
same order as
wickra-core(rolling-sum add/subtract order, the periodic reseed, the finalsum / perioddivision), so the result is identical onthumbv7em-none-eabihf,thumbv6m-none-eabiand an x86-64 host alike. The few transcendental ops (abs,max, fused multiply-add) route through a single [math] switch point — std on a host,libmon bare metal — whose two implementations are IEEE-754 identical.
§Example
use wickra_embed_core::{Indicator, Sma};
let mut sma = Sma::<3>::new();
let mut last = None;
for i in 0..10 {
last = sma.update(100.0 + f64::from(i));
}
assert!(last.is_some());Re-exports§
pub use indicators::Atr;pub use indicators::Ema;pub use indicators::Roc;pub use indicators::Rsi;pub use indicators::Sma;pub use ohlcv::Candle;pub use traits::Indicator;
Modules§
- indicators
- The verified no-alloc indicator subset.
- ohlcv
- The
CandleOHLC bar — theCopyinput type for candle indicators. - ring
- A fixed-capacity ring buffer of
f64, allocation-free. - traits
- The
Indicatorcontract — the same streaming state machinewickra-coreuses, narrowed to a scalarf64output and no allocation.
Functions§
- version
- Crate version string (
CARGO_PKG_VERSION), for the C ABI and diagnostics.