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

@deeptick/client

v0.1.2

Published

DeepTick TypeScript SDK — high-frequency crypto market data

Readme

DeepTick TypeScript SDK

npm install @deeptick/client

The TypeScript SDK provides three layers of access to DeepTick market data:

  1. CachedClient — Download daily Parquet/CSV archives with local disk caching
  2. DeepTickStream — Real-time WebSocket streaming with typed callbacks
  3. DeepTickFeed — Unified live/replay feed (backtest code = production code)
  4. Types & Derive — Full type definitions and client-side derived computations

Quick Start

import { CachedClient } from '@deeptick/client/cache';

const client = new CachedClient("https://api.deeptick.com");

// Load BTC trades for a date range (cached after first download)
const batches = await client.loadTrades(
  "binance_futures",
  "BTCUSDT",
  "2026-05-01",
  "2026-05-02"
);
console.log(`Loaded ${batches.length} daily files.`);
console.log(client.getStats());

Streaming (Real-Time)

import { DeepTickStream } from '@deeptick/client/streaming';

const stream = new DeepTickStream({
  url: "wss://api.deeptick.com/v1/stream?api_key=dtk_your_key"
});

// Typed callbacks for each data type
stream.onTrade((exchange, symbol, trade) => {
  console.log(`[${exchange}] ${symbol}: ${trade.price} x ${trade.amount}`);
});

stream.onBookTicker((exchange, symbol, ticker) => {
  console.log(`[${exchange}] ${symbol}: ${ticker.bid_price}/${ticker.ask_price}`);
});

stream.onDerivativeTicker((exchange, symbol, data) => {
  console.log(`[${exchange}] ${symbol} funding: ${data.funding_rate}`);
});

// Connect and subscribe
await stream.connect();
await stream.subscribe([
  "binance_futures.trades.BTCUSDT",
  "*.book_ticker.*",
  "*.derivative_ticker.*",
]);

// Measure latency
const latency = await stream.ping();
console.log(`Round-trip: ${latency}ms`);

Global Callback

stream.onData((exchange, symbol, data) => {
  // Receives ALL data types
  console.log(exchange, symbol, data);
});

Replay (Historical Tick-by-Tick)

import { DeepTickFeed } from '@deeptick/client/feed';

const feed = DeepTickFeed.replay(
  "wss://api.deeptick.com/v1/replay/ws",
  {
    apiKey: "dtk_your_key",
    sources: [
      "binance_futures:trades:BTCUSDT",
      "binance_futures:book_l2_delta:BTCUSDT",
    ],
    from: "2026-05-01",
    to: "2026-05-02",
    speed: 0, // max speed
  }
);

feed.onData((topic, data) => console.log(topic, data));
feed.onReplayEnd((stats) => {
  console.log(`Replay complete: ${stats.totalEvents} events in ${stats.durationS}s`);
});

await feed.connect();

Auto Mode (Replay → Live)

const feed = DeepTickFeed.auto(
  "wss://api.deeptick.com",
  {
    apiKey: "dtk_your_key",
    sources: ["hyperliquid:trades:BTC"],
    from: "2026-05-01", // replay from here, then switch to live
  }
);

feed.onData((topic, data) => process(data)); // same handler!
feed.onModeChange((from, to) => {
  console.log(`Switched from ${from} to ${to}`);
});

await feed.connect();

Derived Data (Computed On-the-Fly)

import { CachedClient } from '@deeptick/client/cache';
import { derive, unpackLevels } from '@deeptick/client/types';
import type {
  TradeRecord,
  BookDeltaRecord,
  BBORecord,
  CandleRecord,
  BookSnapshot,
  ImbalanceRecord,
  VolumeProfileBucket,
} from '@deeptick/client/types';

const client = new CachedClient("https://api.deeptick.com");

// ── BBO from L2 deltas ──────────────────────────────────────────────
const deltas = await client.loadBookDeltas("binance_futures", "BTCUSDT", "2026-05-01");
const bbo: BBORecord[] = derive.bbo(deltas);
console.log(`BBO rows: ${bbo.length}`);

// ── Candles at any interval ─────────────────────────────────────────
const trades = await client.loadTrades("binance_futures", "BTCUSDT", "2026-05-01");
const candles1m: CandleRecord[] = derive.candles(trades, { intervalMs: 60_000 });
const candles5m: CandleRecord[] = derive.candles(trades, { intervalMs: 300_000 });

// ── Book snapshots (20 levels every 1 min) ──────────────────────────
const snapshots: BookSnapshot[] = derive.bookSnapshots(deltas, {
  depth: 20,
  intervalMs: 60_000,
});

// ── Volume profile ──────────────────────────────────────────────────
const profile: VolumeProfileBucket[] = derive.volumeProfile(trades, {
  numBuckets: 100,
});

// ── Order book imbalance ────────────────────────────────────────────
const imbalance: ImbalanceRecord[] = derive.bookImbalance(deltas, {
  depth: 5,
  intervalMs: 1000,
});

// ── Cross-exchange funding spread ───────────────────────────────────
const hlFunding = await client.loadFunding("hyperliquid", "BTC", "2026-05-01");
const bnFunding = await client.loadFunding("binance_futures", "BTCUSDT", "2026-05-01");
const fundingCross = derive.fundingCross(
  { hyperliquid: hlFunding, binance_futures: bnFunding },
  { intervalMs: 3_600_000 }
);

// ── Cross-exchange basis ────────────────────────────────────────────
const hlTrades = await client.loadTrades("hyperliquid", "BTC", "2026-05-01");
const bnTrades = await client.loadTrades("binance_futures", "BTCUSDT", "2026-05-01");
const basis = derive.crossExchangeBasis(
  { hyperliquid: hlTrades, binance_futures: bnTrades },
  { intervalMs: 1000 }
);

// ── Unpack binary book levels ───────────────────────────────────────
const packed = new Uint8Array(/* from parquet column */);
const levels: [number, number][] = unpackLevels(packed);
// levels = [[price1, size1], [price2, size2], ...]

Type Definitions

// Wire protocol types for streaming
interface StreamTrade {
  exchange: string; symbol: string;
  timestamp: number; local_timestamp: number;
  trade_id: string; price: number; amount: number;
  side: 'buy' | 'sell';
}

interface StreamBookTicker {
  exchange: string; symbol: string;
  timestamp: number; local_timestamp: number;
  bid_price: number; bid_amount: number;
  ask_price: number; ask_amount: number;
}

interface StreamDerivativeTicker {
  exchange: string; symbol: string;
  timestamp: number; local_timestamp: number;
  funding_rate: number | null;
  predicted_funding_rate: number | null;
  open_interest: number | null;
  last_price: number | null;
  mark_price: number | null;
  index_price: number | null;
}

Architecture

client-ts/src/
├── types.ts       # Type definitions + derive namespace (BBO, candles, snapshots)
├── cache.ts       # CachedClient — HTTP download + disk cache
├── streaming.ts   # DeepTickStream — real-time WebSocket (Node + Browser)
└── feed.ts        # DeepTickFeed — unified live/replay feed