JavaScript / WASM

npm package ferro-ta-wasm wraps ferro_ta_core with wasm-bindgen. Node.js (require) and browsers (import + init()) share the same exports.

Installation

npm install ferro-ta-wasm

Node.js

const { sma, rsi, macd, bbands } = require('ferro-ta-wasm');

const close = Float64Array.from({ length: 40 }, (_, i) => 44 + i * 0.1);

const smaOut = sma(close, 5);
const rsiOut = rsi(close, 14);
const [macdLine, signal, hist] = macd(close, 12, 26, 9);
const [upper, middle, lower] = bbands(close, 5, 2.0, 2.0);

Browser

<script type="module">
  import init, { sma, rsi, macd, bbands } from 'ferro-ta-wasm';
  await init();

  const close = Float64Array.from({ length: 40 }, (_, i) => 44 + i * 0.1);
  console.log(sma(close, 5));
  console.log(rsi(close, 14));
  const [macdLine, signal, hist] = macd(close, 12, 26, 9);
  const [upper, middle, lower] = bbands(close, 5, 2.0, 2.0);
</script>

Streaming

Stateful classes are prefixed with Wasm:

const { WasmStreamingSMA, WasmStreamingRSI } = require('ferro-ta-wasm');

const stream = new WasmStreamingSMA(5);
for (const price of close) {
  console.log(stream.update(price));
}

API map

Export names are snake_case. A few names differ from TA-Lib / Python (trix_indicator, math_add, transform_sin); the generated Cross-language coverage table normalizes them.

Category

Exports

Examples

Overlap

20

sma, ema, bbands, macd, sar

Momentum

26

rsi, stoch, plus_di, trix_indicator

Candlestick

61

cdldoji, cdlengulfing, cdlhammer

Volatility / volume

9

atr, obv, mfi, vwap

Math

19+

math_add, transform_sin, transform_sqrt

Streaming

9 classes

WasmStreamingSMA, WasmStreamingRSI, …

Options / futures / backtest

30+

black_scholes_price, futures_basis, backtest_core

The full npm README is wasm/README.md.

Limitations

Large arrays (tens of millions of bars) pay a JS↔WASM copy. For that shape of workload, call ferro_ta_core from Rust or use the Python binding.