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 |
|
Momentum |
26 |
|
Candlestick |
61 |
|
Volatility / volume |
9 |
|
Math |
19+ |
|
Streaming |
9 classes |
|
Options / futures / backtest |
30+ |
|
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.