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

@alphacharts/alerts

v0.1.0

Published

Price alert evaluator and chart plugin for AlphaCharts.

Readme

@alphacharts/alerts

Client-side alerts as a chart plugin, and a pure evaluator that runs the same serialized definitions without a chart (so a backend re-evaluates exactly what the chart does: the plugin delegates to AlertEvaluator).

import { AlertsPlugin, evaluate } from "@alphacharts/alerts";

const alerts = new AlertsPlugin({ drawings, source, onTrigger: (t) => notify(t) });
chart.addPlugin(alerts);
alerts.add({ id: "a", condition: { type: "crossing", price: 25_000, direction: "up" }, trigger: { mode: "oncePerBar" } });
alerts.tick({ time, price, bar });          // from your live feed
alerts.addDrawingAlert({ id: "t", drawingId: line.id, line: "main", op: "crossingUp", trigger: { mode: "once" } });

// server side, same definitions, no chart:
const triggers = evaluate(definitions, ticks, { indicators, logical });

A tick is { time, price, bar }: bar is the open time of the bar it belongs to. Ticks must be in time order and a bar never reopens; anything else throws.

Conditions

| type | meaning | |---|---| | crossing (direction: any/up/down) | price crosses a level. A touch counts (99 → 100 crosses up 100); a touch then a retreat is a cross back. | | greaterThan, lessThan | state: price > / < level (fires on every tick it holds; the trigger mode limits it) | | enteringChannel, exitingChannel | outside → inside / inside → outside [low, high], bounds inclusive | | moving (up/down, bars, amount or percent) | state: price is at least the amount (or percent of the window extreme) above the lowest / below the highest price of the last N bars, the current one included | | indicator (id, op, value) | an indicator from EvalEnv.indicators (a function, or seriesIndicator(series)) against a number or another indicator: crossing / up / down / greaterThan / lessThan. A tick with no value is skipped, never read as 0. | | drawing (geometry, line, op) | price crossing (up/down), entering or exiting a line of a drawing, at the line's price for the tick's bar time. Supported: trendLine, ray, extendedLine, infoLine, horizontalLine, horizontalRay (line main), parallelChannel (base, offset, middle; entering/exiting between base and offset). |

Drawing alerts keep the drawing's geometry in the definition. In the plugin they follow the drawing when it moves, and become orphaned (reported once, never fire) when it is deleted. Pass logical (the plugin uses BarSource.logical) so a line is straight in bar index, as drawn, rather than in time.

Trigger modes

once (then status triggered), oncePerBar (first firing tick of each bar), oncePerBarClose (the condition is evaluated on each bar's last tick, when the bar closes: the next bar's first tick, or closeBar(time); intrabar excursions are invisible), everyTime. Options: debounceMs (in tick time; a suppressed trigger does not spend a once alert), expiresAt (alert becomes expired).

Each AlertTrigger carries alertId, time, bar, price, prevPrice, seq, mode, and values (the numbers compared: level, line price, indicator value, window low/high, threshold).

JSON

AlertEvaluator.toJSON() / AlertsPlugin.toJSON() are versioned (version: 1); the plugin also saves each alert's status. A newer version or any invalid alert is refused before anything is replaced.