indica
Fast technical analysis indicators for stock markets. Built in Rust.
Why
JavaScript/Python TA libraries are slow when screening thousands of stocks. indica computes all indicators for 2,000 stocks in 6ms using Rust + Rayon parallelism.
| Stocks | Sequential | Parallel (Rayon) |
|---|---|---|
| 100 | 0.5ms | 0.3ms |
| 2,000 | 11ms | 6ms |
Indicators
- SMA — Simple Moving Average
- EMA — Exponential Moving Average
- RSI — Relative Strength Index (Wilder's smoothing)
- MACD — Moving Average Convergence Divergence with crossover detection
- Bollinger Bands — Upper, middle, lower bands + %B
- ATR — Average True Range (Wilder's smoothing)
- Pivot Points — Classic (R3/R2/R1/Pivot/S1/S2/S3)
- Volume Trend — Surging / increasing / stable / declining / drying up
- Relative Strength — Stock vs benchmark comparison
Installation
Rust
[]
= "0.1"
Node.js (via NAPI-RS)
Usage (Rust)
use ;
Batch Processing (screen thousands of stocks)
use ;
let stocks = vec!;
// Computes ALL indicators for ALL stocks using all CPU cores
let results = batch_compute_parallel;
for snap in &results
Usage (Node.js)
const = require;
// Single indicator
const rsi = ;
console.log; // 55.37
// MACD with crossover detection
const macd = ;
console.log; // { value: 0.34, signal: 0.28, histogram: 0.06, crossover: 'bullish' }
// Batch: screen 2000 stocks at once
const results = ;
// Returns in ~6ms using all CPU cores
API Reference
Single Indicators
| Function | Input | Output |
|---|---|---|
sma(values, period) |
&[f64], usize |
Option<f64> |
ema(values, period) |
&[f64], usize |
Option<f64> |
rsi(closes, period) |
&[f64], usize |
Option<f64> |
macd(closes, fast, slow, signal) |
&[f64], usize, usize, usize |
Option<MacdResult> |
bollinger_bands(closes, period, std_dev) |
&[f64], usize, f64 |
Option<BollingerBandsResult> |
atr(highs, lows, closes, period) |
&[f64], &[f64], &[f64], usize |
Option<f64> |
pivot_points(high, low, close) |
f64, f64, f64 |
PivotPointsResult |
volume_trend(volumes) |
&[f64] |
&str |
relative_strength(stock, bench, period) |
&[f64], &[f64], usize |
Option<f64> |
Batch
| Function | Input | Output |
|---|---|---|
batch_compute(stocks) |
&[StockData] |
Vec<IndicatorSnapshot> |
batch_compute_parallel(stocks) |
&[StockData] |
Vec<IndicatorSnapshot> |
All functions return Option (Rust's null) when there isn't enough data for the calculation. No panics, no NaN.
Building from Source
# Rust library
# Node.js native addon
License
MIT