Complete technical analysis suite - 189 indicators, risk metrics, pattern recognition. Native + WASM backends for Node.js AND Browser
npm install techkit-full



Complete Technical Analysis Suite
π 189 Indicators β’ π Node.js + Browser β’ π Risk Metrics β’ π Pattern Recognition
Installation β’ Browser Usage β’ Advanced Analytics β’ API Docs
---
TechKit Full is the complete technical analysis solution that runs in both Node.js and Browser:
| Feature | techkit | techkit-full |
|---------|---------|--------------|
| Core Indicators | β
158 | β
158 |
| Advanced Analytics | β | β
31 |
| Risk Metrics | β | β
Sharpe, Sortino, VaR |
| Volatility Models | β | β
GARCH, EWMA |
| Pattern Recognition | β | β
Harmonic, Chart Patterns |
| Browser WASM | β
| β
|
| Node.js Native | β
| β
|
``bash`
npm install techkit-fullor
yarn add techkit-fullor
pnpm add techkit-full
---
TechKit Full runs entirely in the browser via WebAssembly!
`html`
`typescript
import { useEffect, useState } from 'react';
import {
init,
SMA, RSI, MACD, BBANDS,
SHARPE, SORTINO, MAX_DRAWDOWN, HIST_VAR, CVAR,
EWMA_VOL
} from 'techkit-full';
interface PortfolioMetrics {
sharpeRatio: number;
sortinoRatio: number;
maxDrawdown: number;
var95: number;
cvar95: number;
volatility: number;
}
function PortfolioDashboard({ priceData, returnsData }) {
const [initialized, setInitialized] = useState(false);
const [metrics, setMetrics] = useState
const [indicators, setIndicators] = useState(null);
useEffect(() => {
init().then(() => setInitialized(true));
}, []);
useEffect(() => {
if (!initialized) return;
// Calculate technical indicators
const sma20 = SMA.create(20).calculate(priceData);
const rsi = RSI.create(14).calculate(priceData);
const { macd, signal, histogram } = MACD.create(12, 26, 9).calculate(priceData);
const { upper, middle, lower } = BBANDS.create(20, 2, 2).calculate(priceData);
setIndicators({ sma20, rsi, macd, signal, histogram, upper, middle, lower });
// Calculate risk metrics
const sharpeRatio = SHARPE.create(252, 0.02, 252).calculate(returnsData)[0];
const sortinoRatio = SORTINO.create(252, 0.02, 252).calculate(returnsData)[0];
const maxDrawdown = MAX_DRAWDOWN.create().calculate(priceData)[0];
const var95 = HIST_VAR.create(0.95).calculate(returnsData)[0];
const cvar95 = CVAR.create(0.95).calculate(returnsData)[0];
const volatility = EWMA_VOL.create(0.94).calculate(returnsData).slice(-1)[0];
setMetrics({ sharpeRatio, sortinoRatio, maxDrawdown, var95, cvar95, volatility });
}, [initialized, priceData, returnsData]);
if (!initialized) return Loading WASM...;
return (
Risk Metrics
Sharpe Ratio {metrics?.sharpeRatio.toFixed(3)}
Sortino Ratio {metrics?.sortinoRatio.toFixed(3)}
Max Drawdown {(metrics?.maxDrawdown * 100).toFixed(2)}%
95% VaR {(metrics?.var95 * 100).toFixed(2)}%
95% CVaR {(metrics?.cvar95 * 100).toFixed(2)}%
Volatility {(metrics?.volatility * 100).toFixed(2)}%
{/ Render chart with indicators /}
);
}
`
`typescript
import {
init,
SMA, EMA, RSI, MACD, BBANDS, ATR,
SHARPE, MAX_DRAWDOWN, EWMA_VOL
} from 'techkit-full';
class BrowserTradingBot {
private initialized = false;
// Indicator instances (reusable)
private sma20: any;
private sma50: any;
private rsi: any;
private macd: any;
private bbands: any;
private atr: any;
private ewmaVol: any;
// State
private prices: number[] = [];
private returns: number[] = [];
async initialize() {
await init();
// Create all indicators
this.sma20 = SMA.create(20);
this.sma50 = SMA.create(50);
this.rsi = RSI.create(14);
this.macd = MACD.create(12, 26, 9);
this.bbands = BBANDS.create(20, 2, 2);
this.atr = ATR.create(14);
this.ewmaVol = EWMA_VOL.create(0.94);
this.initialized = true;
console.log('π€ Trading Bot WASM initialized!');
}
onNewCandle(open: number, high: number, low: number, close: number, volume: number) {
if (!this.initialized) return;
// Update price history
if (this.prices.length > 0) {
const ret = (close - this.prices[this.prices.length - 1]) / this.prices[this.prices.length - 1];
this.returns.push(ret);
}
this.prices.push(close);
// Calculate indicators (streaming)
const sma20Result = this.sma20.update(close);
const sma50Result = this.sma50.update(close);
const rsiResult = this.rsi.update(close);
const volResult = this.ewmaVol.update(this.returns[this.returns.length - 1] || 0);
// Generate signals
if (sma20Result.valid && sma50Result.valid && rsiResult.valid) {
const signal = this.generateSignal({
sma20: sma20Result.value,
sma50: sma50Result.value,
rsi: rsiResult.value,
volatility: volResult.valid ? volResult.value : 0
});
this.executeSignal(signal);
}
}
private generateSignal(data: any): 'BUY' | 'SELL' | 'HOLD' {
// Golden cross + RSI oversold + low volatility
if (data.sma20 > data.sma50 && data.rsi < 30 && data.volatility < 0.02) {
return 'BUY';
}
// Death cross + RSI overbought
if (data.sma20 < data.sma50 && data.rsi > 70) {
return 'SELL';
}
return 'HOLD';
}
private executeSignal(signal: string) {
console.log(π Signal: ${signal});
// Execute trade via API
}
getPerformanceMetrics() {
if (this.returns.length < 20) return null;
const sharpe = SHARPE.create(252, 0.02, 252).calculate(this.returns);
const maxDD = MAX_DRAWDOWN.create().calculate(this.prices);
return {
sharpeRatio: sharpe[sharpe.length - 1],
maxDrawdown: maxDD[maxDD.length - 1]
};
}
}
// Usage
const bot = new BrowserTradingBot();
await bot.initialize();
// Connect to WebSocket
const ws = new WebSocket('wss://stream.binance.com/ws/btcusdt@kline_1m');
ws.onmessage = (event) => {
const kline = JSON.parse(event.data).k;
if (kline.x) { // Candle closed
bot.onNewCandle(
parseFloat(kline.o),
parseFloat(kline.h),
parseFloat(kline.l),
parseFloat(kline.c),
parseFloat(kline.v)
);
}
};
`
---
Full Documentation: https://techkit-docs.netlify.app/
| Topic | Link |
|-------|------|
| Installation | Getting Started |
| Quick Start | Quick Start Guide |
| Node.js API | Node.js API Reference |
| All Indicators | Indicator List |
| Risk Metrics | Risk Metrics Guide |
| Volatility Models | Volatility Models Guide |
| Examples | Code Examples |
| Changelog | Version History |
| δΈζζζ‘£ | Chinese Documentation |
- Node.js/WASM API Reference
- Python API Reference
- Risk Metrics Guide
- Volatility Models Guide
---
`typescript
import {
init,
SMA, RSI, MACD,
SHARPE, SORTINO, MAX_DRAWDOWN
} from 'techkit-full';
// Initialize (auto-detects Native backend in Node.js)
await init();
const prices = [100, 102, 101, 103, 105, 104, 106, 108, 107, 110];
const returns = prices.slice(1).map((p, i) => (p - prices[i]) / prices[i]);
// Core indicators
const sma = SMA.create(5).calculate(prices);
const rsi = RSI.create(14).calculate(prices);
// Risk metrics (techkit-full exclusive)
const sharpe = SHARPE.create(252, 0.02, 252).calculate(returns);
const sortino = SORTINO.create(252, 0.02, 252).calculate(returns);
const maxDD = MAX_DRAWDOWN.create().calculate(prices);
console.log(
Portfolio Analysis:
Sharpe Ratio: ${sharpe[sharpe.length - 1].toFixed(3)}
Sortino Ratio: ${sortino[sortino.length - 1].toFixed(3)}
Max Drawdown: ${(maxDD[maxDD.length - 1] * 100).toFixed(2)}%);`
---
`typescript
import {
SHARPE, SORTINO, CALMAR,
MAX_DRAWDOWN, HIST_VAR, CVAR
} from 'techkit-full';
await init();
const returns = [0.01, -0.02, 0.015, 0.008, -0.005, 0.02, 0.003, -0.01, 0.025];
// Sharpe Ratio (annualized)
const sharpe = SHARPE.create(252, 0.02, 252); // period, riskFreeRate, annualizationFactor
console.log('Sharpe:', sharpe.calculate(returns));
// Sortino Ratio (penalizes only downside volatility)
const sortino = SORTINO.create(252, 0.02, 252);
console.log('Sortino:', sortino.calculate(returns));
// Calmar Ratio (return / max drawdown)
const calmar = CALMAR.create(252);
console.log('Calmar:', calmar.calculate(returns));
// Value at Risk (95% confidence)
const var95 = HIST_VAR.create(0.95);
console.log('95% VaR:', var95.calculate(returns));
// Conditional VaR (Expected Shortfall)
const cvar95 = CVAR.create(0.95);
console.log('95% CVaR:', cvar95.calculate(returns));
// Maximum Drawdown
const prices = [100, 105, 103, 108, 102, 110, 105];
const maxDD = MAX_DRAWDOWN.create();
console.log('Max Drawdown:', maxDD.calculate(prices));
`
`typescript
import {
EWMA_VOL, GARCH_VOL, REALIZED_VOL,
PARKINSON_VOL, GARMAN_KLASS_VOL
} from 'techkit-full';
await init();
// EWMA Volatility (RiskMetrics standard: Ξ»=0.94)
const ewma = EWMA_VOL.create(0.94);
const ewmaVol = ewma.calculate(returns);
// GARCH(1,1) Volatility
const garch = GARCH_VOL.create();
const garchVol = garch.calculate(returns);
// Realized Volatility (rolling window)
const realized = REALIZED_VOL.create(20);
const realizedVol = realized.calculate(returns);
// Range-based volatility (more efficient)
const parkinson = PARKINSON_VOL.create(20);
const parkVol = parkinson.calculate(high, low);
// Garman-Klass (uses OHLC)
const gk = GARMAN_KLASS_VOL.create(20);
const gkVol = gk.calculate(open, high, low, close);
`
`typescript
import { MACDEXT, STOCHRSI } from 'techkit-full';
await init();
// MACDEXT - MACD with configurable MA types
// MA Types: 0=SMA, 1=EMA, 2=WMA, 3=DEMA, 4=TEMA, 5=TRIMA, 6=KAMA, 7=MAMA, 8=T3
const macdext = MACDEXT.create(
12, // fast period
1, // fast MA type (EMA)
26, // slow period
1, // slow MA type (EMA)
9, // signal period
0 // signal MA type (SMA)
);
const { macd, signal, histogram } = macdext.calculate(prices);
// STOCHRSI - Stochastic applied to RSI
const stochrsi = STOCHRSI.create(14, 14, 3, 3);
const { k, d } = stochrsi.calculate(prices);
``
---
Click to expand
- Moving Averages: SMA, EMA, WMA, DEMA, TEMA, KAMA, TRIMA, T3, MAMA, MAVP
- Momentum: RSI, MACD, STOCH, STOCHF, CCI, ADX, ADXR, APO, PPO, MOM, ROC, TRIX, ULTOSC, WILLR, MFI, CMO, AROON, BOP, DX
- Volatility: ATR, NATR, TRANGE, BBANDS
- Volume: OBV, AD, ADOSC
- Statistics: STDDEV, VAR, LINEARREG, LINEARREG_SLOPE/ANGLE/INTERCEPT, TSF, CORREL, BETA
- Hilbert: HT_TRENDLINE, HT_SINE, HT_TRENDMODE, HT_DCPERIOD, HT_DCPHASE, HT_PHASOR
- Price Transform: AVGPRICE, MEDPRICE, TYPPRICE, WCLPRICE
- Math: MIN, MAX, SUM, ADD, SUB, MULT, DIV, trigonometric functions
- Candlestick Patterns: 61 patterns (CDL*)
| Category | Indicators |
|----------|------------|
| Risk Metrics | SHARPE, SORTINO, CALMAR, MAX_DRAWDOWN, HIST_VAR, CVAR |
| Volatility Models | EWMA_VOL, GARCH_VOL, REALIZED_VOL, PARKINSON_VOL, GARMAN_KLASS_VOL, ROGERS_SATCHELL_VOL, YANG_ZHANG_VOL |
| Structure | ZIGZAG, SWING, PIVOT, SUPPORT_RESISTANCE |
| Patterns | HARMONIC, CHART_PATTERN, ELLIOTT_WAVE |
| Extended | MACDEXT, MACDFIX, STOCHRSI, MA (generic) |
---
| 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 | β
|
---
| Operation | Time | vs Pure JS |
|-----------|------|------------|
| SMA Γ 10k | 0.3ms | 40x faster |
| RSI Γ 10k | 0.5ms | 50x faster |
| SHARPE Γ 1k | 0.1ms | 30x faster |
| GARCH Γ 1k | 2ms | 50x faster |
| Operation | Time | vs Pure JS |
|-----------|------|------------|
| SMA Γ 10k | 1.2ms | 10x faster |
| RSI Γ 10k | 2.0ms | 12x faster |
| SHARPE Γ 1k | 0.3ms | 15x faster |
| GARCH Γ 1k | 5ms | 20x faster |
---
MIT License - see LICENSE for details.
- π Full Documentation - API Reference & Guides
- GitHub Repository
- Issue Tracker
- Changelog
- Base Package (techkit) - 158 core indicators
---
Complete Technical Analysis - Everywhere
Node.js β’ Browser β’ Deno β’ Bun
189 Indicators β’ Risk Metrics β’ Pattern Recognition
Made with β€οΈ by the TechKit Team