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

the0-node

v0.3.1

Published

the0 SDK for Node.js/TypeScript trading bots

Readme

the0-node

Official SDK for building trading bots on the0 platform with Node.js and TypeScript.

Installation

npm install the0-node
# or
yarn add the0-node

Migrating from GitHub Packages? This package was previously published there as @alexanderwanyoike/the0-node. Update your dependency to the0-node and remove the @alexanderwanyoike:registry line from your .npmrc (project or ~/.npmrc).

Quick Start

import { parse, success, error, metric } from 'the0-node';

// Parse bot configuration from environment
const { id, config } = parse<{
  symbol: string;
  amount: number;
}>();

console.log(`Bot ${id} starting...`);
console.log(`Trading ${config.symbol} with amount ${config.amount}`);

// Emit metrics for the dashboard
metric('price', {
  symbol: config.symbol,
  value: 45000.50,
  change_pct: 2.5
});

// Signal completion
success('Trade executed successfully', {
  tradeId: '12345',
  filledAmount: config.amount
});

API Reference

parse<T>(): BotInput<T>

Parse bot configuration from environment variables.

const { id, config } = parse();

// With typed config
interface MyConfig {
  symbol: string;
  amount: number;
  paper?: boolean;
}
const { id, config } = parse<MyConfig>();

success(message: string, data?: object): void

Output a success result.

success('Trade completed');
success('Trade completed', { tradeId: '12345' });

error(message: string, data?: object): never

Output an error result and exit with code 1.

error('Failed to connect');
error('Trade failed', { reason: 'Insufficient funds' });

result(data: object): void

Output a custom result object.

result({
  status: 'success',
  signals: [{ symbol: 'BTC/USD', direction: 'long' }]
});

metric(type: string, data: object): void

Emit a metric for the platform dashboard.

metric('price', { symbol: 'BTC/USD', value: 45000 });
metric('signal', { direction: 'long', confidence: 0.85 });
metric('alert', { type: 'price_spike', severity: 'high' });

log(message: string, data?: object): void

Log a message to the bot's output.

log('Starting execution');
log('Order placed', { orderId: '12345' });

sleep(ms: number): Promise<void>

Async sleep utility.

await sleep(5000); // Wait 5 seconds

Bot Types

Scheduled Bots

Run on a cron schedule, execute once, and exit:

import { parse, success, error } from 'the0-node';

const { id, config } = parse();

try {
  // Execute your trading logic
  const result = await executeTrade(config);
  success('Trade completed', result);
} catch (err) {
  error(`Trade failed: ${err.message}`);
}

Realtime Bots

Run continuously until stopped:

import { parse, metric, sleep } from 'the0-node';

const { id, config } = parse();

// Main loop
while (true) {
  const price = await fetchPrice(config.symbol);

  metric('price', {
    symbol: config.symbol,
    value: price
  });

  await sleep(config.updateInterval || 5000);
}

Publishing (Maintainers)

This package is published to the public npm registry.

Prerequisites

Authenticate with npm as a maintainer of the package:

npm login

Publish

# Build the package
yarn build

# Publish to npm
npm publish

Version Bump

# Patch release (0.1.0 -> 0.1.1)
npm version patch

# Minor release (0.1.0 -> 0.2.0)
npm version minor

# Major release (0.1.0 -> 1.0.0)
npm version major

License

Apache-2.0