npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ta-crypto

v0.4.2

Published

Technical analysis for crypto markets in Node.js

Readme

ta-crypto

npm version npm downloads TypeScript types CI license

Technical analysis indicators and crypto-market utilities for Node.js. The current stable release line is v0.4.

Install

npm install ta-crypto

Start here

import { rsi, atr, toOHLCV } from "ta-crypto";

const candles = [
  { open: 100, high: 102, low: 99, close: 101, volume: 10, time: 1 },
  { open: 101, high: 103, low: 100, close: 102, volume: 12, time: 2 }
];

const { high, low, close } = toOHLCV(candles);
const rsi14 = rsi(close, 14);
const atr14 = atr(high, low, close, 14);

Indicator results are aligned with the input. Values that need more history are returned as null.

Choose an API

| Task | Use | Reference | | --- | --- | --- | | Normalize candle objects or aliases | toOHLCV, pluck* | Inputs and candles | | Calculate classic indicators in batch | sma, rsi, macd, atr, adx, and others | Indicators | | Calculate funding, session VWAP, volatility regimes, or candle-derived orderflow | ta-crypto/crypto | Crypto utilities | | Process prices or candles one at a time | createSMA, createEMA, createRSI, createMACD, createATR, createBBANDS, createVWAPSession, createRealizedVolatility, createVolatilityRegime, createVolumeDelta, createOrderflowImbalance | Stateful API | | Review benchmarks, scaling guards, and regression policy | deterministic harness and baseline | Performance & benchmarks | | Review tolerances and external references | compatibility scripts and policy | Compatibility | | Verify releases and project limitations | CI, tags, changelog, and trust policy | Trust and verification |

Module imports

import { sma, createMACD } from "ta-crypto/indicators";
import { vwapSession, createVolumeDelta } from "ta-crypto/crypto";
import { toOHLCV } from "ta-crypto/candles";
import { createRSI, createBBANDS } from "ta-crypto/stateful";

The root ta-crypto entry point exports all public functions, stateful constructors, and types.

Streaming example

import { createMACD, createATR, createBBANDS, createVolumeDelta } from "ta-crypto";

const macd = createMACD(12, 26, 9);
const atr = createATR(14);
const bbands = createBBANDS(20, 2);
const volDelta = createVolumeDelta(14);

for (const candle of liveCandles) {
  const m = macd.next(candle.close);       // { macd, signal, histogram }
  const a = atr.next(candle);              // number | null
  const bb = bbands.next(candle.close);    // { basis, upper, lower }
  const vd = volDelta.next(candle);        // number | null
  // Values remain null until individual indicator warmup is complete.
}

See Stateful API for warmup, parity, and reset behavior.

What is included

  • Batch overlap, momentum, volatility, performance, volume, and trend indicators.
  • Candle normalization for long keys and o/h/l/c/v/t aliases.
  • Stateful streaming constructors (createSMA, createEMA, createRSI, createMACD, createATR, createBBANDS, createVWAPSession, createRealizedVolatility, createVolatilityRegime, createVolumeDelta, createOrderflowImbalance).
  • Crypto-specific funding, volatility-regime, session-VWAP, and orderflow-proxy utilities.
  • Golden regression tests and external compatibility checks against TA-Lib and technicalindicators.

What is not included

  • A backtest or portfolio accounting engine.
  • Built-in strategies, screeners, or exchange/network adapters.
  • Complete multi-timeframe alignment or candle resampling.
  • L2/L3 order-book imbalance. Current orderflow functions are candle-derived proxies.

These items remain roadmap work and must not be treated as current package capabilities.

Known behavior in v0.4

  • percentReturn(values, { cumulative: true }) compounds cumulative return from the initial price (issue #27). Arithmetic sum of periodic returns is available via sumPeriodicReturns(values) or { mode: "sum" }. The deprecated boolean signature is supported with compound semantics during the v0.4 migration window.
  • logReturn, realizedVolatility, and volatilityRegime enforce strictly positive prices ($P_t > 0$) with index-aware errors (issue #28).
  • natr enforces strictly positive closing prices ($close > 0$) with index-aware errors (issue #29).
  • Period-bearing batch indicators and stateful constructors uniformly validate positive integer periods (issue #30).

Examples

Runnable examples are in examples/:

npm run example:all

They cover RSI signals, batch/stateful session VWAP parity, funding metrics, and an external RSI comparison.

Development

npm ci
npm test

Additional compatibility and benchmark commands are documented in CONTRIBUTING.md.

GitHub Actions and Release Please are the single release authority. Conventional commits on main create or update a Release PR; merging that PR creates the matching tag and GitHub Release, runs the release checks, and publishes to npm. Local commands are limited to validation and dry runs. See Trust and verification for the complete flow and recovery boundaries.

Project references