Expand description
§polars-ta-core
Pure algorithm layer for polars-ta. All functions operate on &[f64] slices
and have zero external dependencies, making this crate suitable for
embedded systems, WASM, and no_std environments.
§Output Convention
Output arrays are shorter than input arrays by lookback elements,
matching ta-lib’s C API behavior exactly:
Input: [v0, v1, v2, v3, v4, v5, v6, v7, v8, v9] len=10
SMA(3): lookback=2
Output: [v2', v3', v4', v5', v6', v7', v8', v9'] len=8The caller is responsible for aligning output indices with the original input.
§Error Handling
- Input length <
lookback + 1: returns an emptyVec(never panics) - NaN inputs: once a NaN enters the sliding sum, all subsequent outputs are NaN (IEEE 754 arithmetic, identical to ta-lib C behavior)
- All-NaN inputs: returns all-NaN output of correct length
§Modules
trend— SMA, EMA, WMA, DEMA, TEMA, MACD, BBands, SAR, ADXoscillator— RSI, Stoch, StochRSI, CCI, Williams %R, ULTOSC, Aroon, MFIvolume— OBV, AD, ADOSCvolatility— ATR, NATR, TRangeprice_transform— AVGPRICE, MEDPRICE, TYPPRICE, WCLPRICEmath_transform— ACOS, ASIN, ATAN, CEIL, COS, COSH, EXP, FLOOR, LN, LOG10, SIN, SINH, SQRT, TAN, TANHmath_ops— ADD, DIV, MULT, SUB, MAX, MIN, SUM, MAXINDEX, MININDEX, MINMAX, MINMAXINDEX
Modules§
- hilbert
- Hilbert Transform indicators — 6 functions matching ta-lib exactly.
- math_
ops - Math Operator indicators: arithmetic operations and rolling window statistics.
- math_
transform - Math Transform — Element-wise Mathematical Functions
- oscillator
- Oscillator indicators: momentum and mean-reversion oscillators.
- pattern
- Candlestick pattern recognition — 61 patterns matching ta-lib.
- price_
transform - statistic
- Statistical indicators: regression, correlation, variance, and forecast functions.
- trend
- Trend indicators: moving averages and trend-following oscillators.
- volatility
- Volatility indicators: average true range and related measures.
- volume
- Volume indicators: accumulation/distribution and volume flow.