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

@lacspace/indicators

v1.1.1

Published

Streaming technical indicators (RSI, MACD, EMA, Bollinger, ATR, Supertrend, ADX, VWAP) with O(1) incremental updates for live price feeds. Zero-dependency.

Readme

@lacspace/indicators

Streaming technical indicators for live price feeds — push one tick, get the new value in O(1).

npm version install size minzipped types license

Most JS indicator libs recompute the entire array on every new candle. This one updates incrementally — feed a single live LTP tick and the indicator advances in O(1). Built for real-time charts, screeners and algo bots.

  • 📈 RSI, MACD, SMA, EMA, WMA, Bollinger, ATR, VWAP, Stochastic, Supertrend, ADX
  • ⚡ Incremental next(tick) API — perfect for websocket / LTP streams
  • 🧮 Batch helpers too — run over a historical array in one call
  • ✂️ crossedAbove / crossedBelow for signal logic
  • 🌍 Isomorphic (browser + Node) · 📦 ESM + CJS · 🧩 zero dependencies · fully typed

Install

npm install @lacspace/indicators      # or pnpm add / yarn add / bun add

Streaming — the whole point

import { RSI, MACD } from "@lacspace/indicators";

const rsi = new RSI(14);
const macd = new MACD(12, 26, 9);

// wire straight into your tick feed
socket.on("ltp", (price) => {
  const r = rsi.next(price);       // O(1) — no array recompute
  const m = macd.next(price);
  if (r !== null && r > 70) console.log("overbought", r.toFixed(1));
  if (m) console.log("histogram", m.histogram.toFixed(2));
});

Every indicator returns null during its warm-up window, then a number (or a struct), and also exposes .value.

Batch over history

import { rsi, ema, bollinger, supertrend } from "@lacspace/indicators";

const closes = candles.map((c) => c.close);

rsi(closes, 14);          // (number | null)[]
ema(closes, 20);          // (number | null)[]
bollinger(closes, 20, 2); // ({ middle, upper, lower, bandwidth } | null)[]

// range-based indicators take OHLC bars
supertrend(candles, 10, 3); // ({ value, direction: 1 | -1 } | null)[]

Signals with crossovers

import { ema, crossedAbove } from "@lacspace/indicators";

const fast = ema(closes, 9);
const slow = ema(closes, 21);

for (let i = 1; i < closes.length; i++) {
  if (fast[i - 1] == null || slow[i - 1] == null) continue;
  const golden = crossedAbove(
    { a: fast[i - 1]!, b: slow[i - 1]! },
    { a: fast[i]!, b: slow[i]! },
  );
  if (golden) console.log("EMA golden cross at bar", i);
}

Indicators

| Class / fn | Input | Output | | --- | --- | --- | | SMA EMA WMA | price | number | | RSI | price | 0–100 | | MACD | price | { macd, signal, histogram } | | BollingerBands | price | { middle, upper, lower, bandwidth } | | ATR | HLC bar | number | | VWAP | H/L/C/volume bar | number | | Stochastic | HLC bar | { k, d } | | Supertrend | HLC bar | { value, direction } | | ADX | HLC bar | { adx, plusDI, minusDI } |

Batch equivalents: sma ema wma rsi macd bollinger atr supertrend adx.

The Lacspace StockKit

| Package | For | | --- | --- | | @lacspace/indicators | Technical indicators (this package) | | @lacspace/market | P&L, XIRR, brokerage & charges | | @lacspace/market-clock | Is the market open? holidays | | @lacspace/paper-trade | Headless paper-trading engine |

New in 1.1 — candle aggregation & pattern detection

import { CandleAggregator, detectPatterns } from "@lacspace/indicators";

// Turn a live LTP/tick feed into fixed-interval OHLC candles
const agg = new CandleAggregator(60_000); // 1-minute
onTick(({ time, price, volume }) => {
  const candle = agg.add({ time, price, volume });
  if (candle) store.push(candle); // completed candle on each rollover
});

// Spot candlestick patterns across a series
detectPatterns(candles);
// → [{ index: 42, pattern: "bullishEngulfing", bullish: true }, …]
// doji · hammer · shootingStar · marubozu · bullish/bearish engulfing · harami

Licensing

This package is free under the Lacspace Free Licence — MIT-equivalent freedoms. Use it in personal and commercial projects at no cost; just keep the notice.

Not every Lacspace package is free. We also offer Commercial (paid), Client-specific, and Private (proprietary) packages under separate terms. See the full Lacspace Licence Centre.


Part of the Lacspace ecosystem — 35 zero-dependency, isomorphic TypeScript packages.

All packages ↗ · npm org ↗ · Licence Centre ↗ · GitHub ↗