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 🙏

© 2025 – Pkg Stats / Ryan Hefner

techkit

v1.2.9

Published

High-performance technical analysis library - Native + WASM backends, 158+ TA-Lib compatible indicators, works in Node.js AND Browser

Readme

TechKit

npm version npm downloads License: MIT Documentation

High-Performance Technical Analysis Library

🚀 Native + WASM • 📊 158+ Indicators • 🌐 Node.js + Browser

InstallationQuick StartBrowser UsageAPI Docs


✨ Features

| Feature | Description | |---------|-------------| | 🚀 Dual Backend | Native C++ for Node.js, WebAssembly for Browser | | 🌐 Browser Support | Full WASM support - run technical analysis in the browser! | | 📊 158+ Indicators | Complete TA-Lib compatible indicator set | | 🎯 100% Accurate | Validated against TA-Lib with < 1e-10 error tolerance | | ⚡ High Performance | Native: 10-100x faster, WASM: 5-20x faster than pure JS | | 💾 Memory Efficient | O(1) incremental updates, minimal footprint | | 🔒 Thread Safe | Each indicator instance is independent | | 📦 Zero Dependencies | No runtime dependencies |

📦 Installation

npm install techkit
# or
yarn add techkit
# or
pnpm add techkit

🚀 Quick Start

Node.js Usage

import { init, SMA, EMA, RSI, MACD, BBANDS } from 'techkit';

// Initialize (auto-detects best backend: Native in Node.js)
await init();

// Sample price data
const prices = [44.34, 44.09, 44.15, 43.61, 44.33, 44.83, 45.10, 45.42, 45.84, 46.08];

// Create indicator instances
const sma = SMA.create(20);
const rsi = RSI.create(14);

// Calculate over array
const smaResult = sma.calculate(prices);
const rsiResult = rsi.calculate(prices);

console.log('SMA:', smaResult);
console.log('RSI:', rsiResult);

🌐 Browser Usage (WASM)

TechKit runs entirely in the browser via WebAssembly! No server required.

Basic Browser Setup

<!DOCTYPE html>
<html>
<head>
    <title>TechKit Browser Demo</title>
</head>
<body>
    <script type="module">
        import { init, SMA, RSI, MACD, BBANDS } from 'https://unpkg.com/techkit/dist/browser.mjs';
        
        // Initialize WASM backend (required in browser)
        await init();
        
        // Now use indicators just like in Node.js!
        const prices = [44.34, 44.09, 44.15, 43.61, 44.33, 44.83, 45.10];
        
        const sma = SMA.create(5);
        const rsi = RSI.create(14);
        
        console.log('SMA:', sma.calculate(prices));
        console.log('RSI:', rsi.calculate(prices));
    </script>
</body>
</html>

React/Vue/Angular Integration

// React Component Example
import { useEffect, useState } from 'react';
import { init, SMA, RSI, MACD } from 'techkit';

function TechnicalChart({ priceData }) {
    const [indicators, setIndicators] = useState(null);
    const [initialized, setInitialized] = useState(false);
    
    useEffect(() => {
        // Initialize WASM on component mount
        init().then(() => setInitialized(true));
    }, []);
    
    useEffect(() => {
        if (!initialized || !priceData.length) return;
        
        // Create indicators
        const sma20 = SMA.create(20);
        const sma50 = SMA.create(50);
        const rsi = RSI.create(14);
        const macd = MACD.create(12, 26, 9);
        
        // Calculate
        setIndicators({
            sma20: sma20.calculate(priceData),
            sma50: sma50.calculate(priceData),
            rsi: rsi.calculate(priceData),
            macd: macd.calculate(priceData)
        });
    }, [initialized, priceData]);
    
    if (!initialized) return <div>Loading WASM...</div>;
    
    return (
        <div>
            {/* Render chart with indicators */}
        </div>
    );
}

Vue 3 Example

<template>
  <div>
    <div v-if="!initialized">Loading WASM...</div>
    <div v-else>
      <p>SMA(20): {{ sma20 }}</p>
      <p>RSI(14): {{ rsi14 }}</p>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted, watch } from 'vue';
import { init, SMA, RSI } from 'techkit';

const props = defineProps(['prices']);
const initialized = ref(false);
const sma20 = ref([]);
const rsi14 = ref([]);

onMounted(async () => {
  await init();
  initialized.value = true;
});

watch([() => props.prices, initialized], ([prices, ready]) => {
  if (!ready || !prices.length) return;
  
  const smaIndicator = SMA.create(20);
  const rsiIndicator = RSI.create(14);
  
  sma20.value = smaIndicator.calculate(prices);
  rsi14.value = rsiIndicator.calculate(prices);
});
</script>

Real-Time Chart Application

import { init, SMA, EMA, RSI, MACD, BBANDS } from 'techkit';

class TradingDashboard {
    private sma: any;
    private rsi: any;
    private macd: any;
    private bbands: any;
    private initialized = false;
    
    async initialize() {
        // Initialize WASM backend
        await init();
        
        // Create indicator instances (reusable!)
        this.sma = SMA.create(20);
        this.rsi = RSI.create(14);
        this.macd = MACD.create(12, 26, 9);
        this.bbands = BBANDS.create(20, 2, 2);
        
        this.initialized = true;
        console.log('TechKit WASM initialized!');
    }
    
    calculateIndicators(prices: number[]) {
        if (!this.initialized) {
            throw new Error('Call initialize() first!');
        }
        
        return {
            sma: this.sma.calculate(prices),
            rsi: this.rsi.calculate(prices),
            macd: this.macd.calculate(prices),
            bbands: this.bbands.calculate(prices)
        };
    }
    
    // Streaming updates
    onNewPrice(price: number) {
        const smaResult = this.sma.update(price);
        const rsiResult = this.rsi.update(price);
        
        if (smaResult.valid) {
            this.updateChart('sma', smaResult.value);
        }
        if (rsiResult.valid) {
            this.updateChart('rsi', rsiResult.value);
        }
    }
    
    private updateChart(indicator: string, value: number) {
        // Update your chart library (Chart.js, Highcharts, etc.)
    }
}

// Usage
const dashboard = new TradingDashboard();
await dashboard.initialize();

// Fetch price data
const prices = await fetchPrices('BTCUSD');
const indicators = dashboard.calculateIndicators(prices);

// Subscribe to real-time updates
websocket.on('price', (price) => dashboard.onNewPrice(price));

Webpack/Vite Configuration

Vite (vite.config.js):

export default {
    optimizeDeps: {
        exclude: ['techkit']  // Let Vite handle WASM properly
    },
    build: {
        target: 'esnext'  // Required for top-level await
    }
}

Webpack (webpack.config.js):

module.exports = {
    experiments: {
        asyncWebAssembly: true,
        topLevelAwait: true
    },
    module: {
        rules: [
            {
                test: /\.wasm$/,
                type: 'webassembly/async'
            }
        ]
    }
};

🔄 Streaming / Incremental Updates

Perfect for real-time data feeds in both Node.js and Browser:

import { init, SMA, RSI } from 'techkit';

await init();

// Create stateful indicators
const sma = SMA.create(20);
const rsi = RSI.create(14);

// WebSocket real-time feed
const ws = new WebSocket('wss://stream.example.com/prices');

ws.onmessage = (event) => {
    const price = JSON.parse(event.data).price;
    
    // O(1) incremental update - no recalculation!
    const smaResult = sma.update(price);
    const rsiResult = rsi.update(price);
    
    if (smaResult.valid && rsiResult.valid) {
        console.log(`SMA: ${smaResult.value.toFixed(2)}, RSI: ${rsiResult.value.toFixed(2)}`);
        updateUI(smaResult.value, rsiResult.value);
    }
};

📊 Available Indicators

Moving Averages

| Function | Description | Parameters | |----------|-------------|------------| | SMA | Simple Moving Average | period | | EMA | Exponential Moving Average | period | | WMA | Weighted Moving Average | period | | DEMA | Double Exponential MA | period | | TEMA | Triple Exponential MA | period | | KAMA | Kaufman Adaptive MA | period | | TRIMA | Triangular MA | period | | T3 | T3 Moving Average | period, vFactor |

Momentum Indicators

| Function | Description | Parameters | |----------|-------------|------------| | RSI | Relative Strength Index | period | | MACD | MACD | fast, slow, signal | | STOCH | Stochastic Oscillator | kPeriod, kSlow, dPeriod | | CCI | Commodity Channel Index | period | | ADX | Average Directional Index | period | | MOM | Momentum | period | | ROC | Rate of Change | period | | WILLR | Williams %R | period | | MFI | Money Flow Index | period | | APO | Absolute Price Oscillator | fast, slow | | PPO | Percentage Price Oscillator | fast, slow | | CMO | Chande Momentum Oscillator | period | | AROON | Aroon Indicator | period | | ULTOSC | Ultimate Oscillator | p1, p2, p3 | | TRIX | Triple Smooth EMA | period |

Volatility Indicators

| Function | Description | Parameters | |----------|-------------|------------| | ATR | Average True Range | period | | NATR | Normalized ATR | period | | TRANGE | True Range | - | | BBANDS | Bollinger Bands | period, nbDevUp, nbDevDn |

Volume Indicators

| Function | Description | Parameters | |----------|-------------|------------| | OBV | On Balance Volume | - | | AD | Accumulation/Distribution | - | | ADOSC | A/D Oscillator | fast, slow |

Statistical Functions

| Function | Description | Parameters | |----------|-------------|------------| | STDDEV | Standard Deviation | period | | VAR | Variance | period | | LINEARREG | Linear Regression | period | | LINEARREG_SLOPE | LR Slope | period | | LINEARREG_ANGLE | LR Angle | period | | CORREL | Pearson Correlation | period | | BETA | Beta Coefficient | period |

Hilbert Transform (Cycle Indicators)

| Function | Description | |----------|-------------| | HT_TRENDLINE | Instantaneous Trendline | | HT_SINE | SineWave | | HT_TRENDMODE | Trend vs Cycle Mode | | HT_DCPERIOD | Dominant Cycle Period | | HT_DCPHASE | Dominant Cycle Phase | | HT_PHASOR | Phasor Components |


⚡ Performance

Node.js (Native Backend)

| Indicator | TechKit | Pure JS | Speedup | |-----------|---------|---------|---------| | SMA(20) × 10k | 0.3ms | 12ms | 40x | | RSI(14) × 10k | 0.5ms | 25ms | 50x | | MACD × 10k | 0.8ms | 45ms | 56x | | BBANDS × 10k | 0.6ms | 35ms | 58x |

Browser (WASM Backend)

| Indicator | TechKit WASM | Pure JS | Speedup | |-----------|--------------|---------|---------| | SMA(20) × 10k | 1.2ms | 12ms | 10x | | RSI(14) × 10k | 2.0ms | 25ms | 12x | | MACD × 10k | 3.2ms | 45ms | 14x | | BBANDS × 10k | 2.4ms | 35ms | 15x |

Benchmarks on Chrome 120, Apple M1


📖 Documentation

Full Documentation: https://techkit-docs.netlify.app/

Quick Links

| Topic | Link | |-------|------| | Installation | Getting Started | | Quick Start | Quick Start Guide | | Node.js API | Node.js API Reference | | All Indicators | Indicator List | | Examples | Code Examples | | Changelog | Version History | | 中文文档 | Chinese Documentation |

🔧 API Reference

📖 Full API documentation: techkit-docs.netlify.app/en/api/nodejs-api/

Initialization

import { init, getBackendInfo } from 'techkit';

// Initialize backend (required before using indicators)
await init();

// Check which backend is active
const info = getBackendInfo();
console.log(info);
// Node.js: { type: 'native', ready: true }
// Browser: { type: 'wasm', ready: true }

Indicator Factory Pattern

// All indicators use the factory pattern
const indicator = IndicatorName.create(param1, param2, ...);

// Calculate over array
const results = indicator.calculate(dataArray);

// Incremental update (returns { value, valid })
const result = indicator.update(newValue);

// Reset state
indicator.reset();

// Properties
indicator.lookback;  // Warmup period needed
indicator.ready;     // Is warmup complete?

Multi-Output Indicators

// MACD returns 3 arrays
const macd = MACD.create(12, 26, 9);
const { macd: macdLine, signal, histogram } = macd.calculate(prices);

// Bollinger Bands returns 3 arrays
const bbands = BBANDS.create(20, 2, 2);
const { upper, middle, lower } = bbands.calculate(prices);

// Stochastic returns 2 arrays
const stoch = STOCH.create(14, 3, 3);
const { k, d } = stoch.calculate(high, low, close);

🌍 Platform Support

| Platform | Environment | Backend | Status | |----------|-------------|---------|--------| | Browser | Chrome/Firefox/Safari/Edge | WASM | ✅ | | Node.js | Windows x64 | Native | ✅ | | Node.js | macOS x64 | Native | ✅ | | Node.js | macOS ARM64 (M1/M2) | Native | ✅ | | Node.js | Linux x64 | Native | ✅ | | Deno | All platforms | WASM | ✅ | | Bun | All platforms | Native/WASM | ✅ |


📄 License

MIT License - see LICENSE for details.

🔗 Links


Works everywhere JavaScript runs!

Node.js • Browser • Deno • Bun

Made with ❤️ by the TechKit Team