Fast time-series analytics library with a C++/AVX2 core and Python bindings via pybind11.
Rolling stats (mean, variance, z-score, autocorrelation), RSI, MACD. Lazy API, chunked streaming for large arrays, Polars DataFrame integration.
uv pip install -e . --no-build-isolation
Requires Python 3.12, CMake, a compiler with AVX2 support (falls back to scalar on ARM).
import numpy as np
from tslib import TimeSeries
ts = TimeSeries(prices)
rw = ts.rolling(20)
rw.mean()
rw.variance()
rw.zscore()
rw.autocorr(lag=1)# technical indicators
rsi = ts.rsi(14)
macd = ts.macd(12, 26, 9) # returns dict with 'macd', 'signal', 'histogram'# chunked processing for large arrays
for chunk in ts.chunked(5_000_000, overlap=19):
m = TimeSeries(chunk).rolling(20).mean()# polars integration
from tslib import from_polars, apply_rolling
df = apply_rolling(df, col="close", window=20, ops=["mean", "variance", "zscore"])
ts = from_polars(df, "volume")uv run benchmarks/bench_python.pyRolling mean, window=20, N=10,000,000 (4 threads):
| time | |
|---|---|
| numpy convolve | 207.8 ms |
| pandas rolling | 243.4 ms |
| tslib | 20.3 ms |
10.3x faster than numpy, 12.0x faster than pandas
Rolling variance: 14.8x faster than pandas rolling var.