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

kwant

v3.0.1

Published

React canvas charts for candlesticks, numeric lines, and PnL.

Readme

Kwant

React canvas charts for candlesticks, numeric/time lines, and PnL displays. Kwant owns rendering and interaction; callers own data fetching.

Install

npm install kwant

Kwant v3 uses explicit stylesheets and does not inject a <style> element.

Candlesticks

import { KwantChart, type CandleSeries } from "kwant";
import "kwant/styles.css";

const series: CandleSeries[] = [
  {
    interval: "1m",
    data: [
      {
        start: Date.UTC(2026, 0, 1, 9, 30),
        end: Date.UTC(2026, 0, 1, 9, 31),
        open: 100,
        high: 103,
        low: 99,
        close: 102,
        volume: 1_250,
        trades: 42,
      },
    ],
  },
];

<KwantChart
  series={series}
  asset="ACME"
  sourceName="Example feed"
  showSource
  livePrice
  width={900}
  height={600}
/>;

Supply one series per available interval. Timestamps are Unix milliseconds. Supported intervals are 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 12h, 1d, 3d, 1w, and 1M.

Replacement mode treats every series value as authoritative. For incremental feeds, opt into bounded per-chart timestamp upserts:

<KwantChart
  series={updates}
  asset="ACME"
  dataMode="upsert"
  dataKey="acme-feed-v1"
  maxPointsPerSeries={50_000}
/>;

Changing dataKey clears retained history. Invalid points are filtered and can be observed through onDataIssues; set invalidDataBehavior="throw" for strict validation.

Generic line charts

import { KwantLineChart, type LinePoint } from "kwant/line";
import "kwant/line.css";

const returns: LinePoint[] = [
  { x: Date.UTC(2026, 0, 1), y: 1.2 },
  { x: Date.UTC(2026, 0, 2), y: 1.8 },
];

<KwantLineChart
  data={returns}
  name="Strategy return"
  title="Performance"
  xAxis={{ scale: "time", label: "Time" }}
  yAxis={{ label: "Return", formatter: (value) => `${value.toFixed(2)}%` }}
/>;

Set xAxis.scale="linear" for ordinary numeric x values. Full layout supports hover, keyboard point inspection, dragging, and cursor-anchored wheel zoom.

PnL preset

PnL is a preset on the generic renderer, not a separate component:

<KwantLineChart
  data={pnl}
  variant="pnl"
  xAxis={{ scale: "time", label: "Time" }}
  yAxis={{ label: "PnL", formatter: (value) => `$${value.toFixed(2)}` }}
/>

The preset includes zero in the domain, draws a zero reference line, and splits the line and area fill into positive and negative colors at the exact crossing. Override any preset option with colorMode, areaFill, theme, or yAxis.

Use layout="compact" for cards and table rows. Compact charts keep hover and keyboard inspection but never capture scrolling, dragging, or pinch gestures.

Appearance and formatting

Both charts accept a partial theme. KwantChart additionally supports runtime settings with showSettings (enabled by default). Use priceFormatter, volumeFormatter, and timeFormatter for application-specific display.

Built-in time presentation supports timeZone="UTC" (default) and timeZone="local".

See MIGRATION.md when upgrading from v2.