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

khazars-quant

v1.1.0

Published

Working crypto quant trading js

Readme

Khazars Quant

Khazars Quant is a Node.js SDK that provides a unified interface for crypto trading adapters across CEX and DeFi venues.

The SDK focuses on account queries, balances, order placement, cancellation, open orders, order history, positions, leverage controls, DEX quote/swap helpers, and consistent error handling.

Current status: the SDK is usable for local development, adapter integration, public market/account wrapper work, and testnet or simulated trading validation. Before using it for live trading, run the private account/order/cancel flow against each target exchange with real testnet or simulated credentials.

Supported Adapters

CEX

  • [x] Binance spot
  • [x] Binance USD-M futures
  • [x] OKX spot
  • [x] OKX swap/futures
  • [x] Bybit spot
  • [x] Bybit USDT perpetuals
  • [x] Hyperliquid spot
  • [x] Hyperliquid perpetuals

DeFi

  • [x] 1inch swap API
  • [x] Uniswap V2 Router02

Install

From npm:

npm install khazars-quant

From this repository:

npm install

For production Hyperliquid access, install the official SDK. If it is unavailable, Khazars falls back to the local test stub.

npm install @nktkas/hyperliquid

1inch production calls require an API key from the 1inch developer portal. Pass it in the chain options or set ONEINCH_API_KEY.

Quick Start

const { quant } = require("./khazars");

const binance = new quant("binance_spot", ["apiKey", "apiSecret"]);
const account = await binance.account();

const hyper = new quant("hyperliquid_perp", ["apiKey", "apiSecret"], {
  defaultLeverage: 5
});
const order = await hyper.placeOrder({
  symbol: "BTC-USDC",
  side: "long",
  price: 25000,
  size: 0.1
});

Unified Response Shape

All documented adapter methods return the same high-level shape.

{ status: true, data: {} }
{
  status: false,
  error: {
    name: "KhazarsError",
    message: "Missing credential field(s): KEY, SEC",
    code: "MISSING_CREDENTIALS",
    exchange: "binance_spot"
  }
}

The SDK catches local validation errors, missing credentials, HTTP failures, invalid JSON responses, network errors, and exchange business errors where the exchange returns a non-success code.

Adapter Construction

new quant(type, keys, options)
  • type: adapter name, such as binance_spot, okx_future, bybit_u_future, uniswap, or 1inch.
  • keys: API key tuple. CEX adapters use [apiKey, apiSecret]; OKX uses [apiKey, apiSecret, passphrase]; DeFi uses [privateKey].
  • options: string base URL or an object. CEX adapters accept common options such as { baseUrl, timeout } plus exchange-specific options such as OKX { passphrase, simulated }, Bybit { testnet, recvWindow, accountType, category }, and Hyperliquid { account, defaultLeverage }. DeFi adapters accept { chainId, rpc, router, apiKey }.

See interface.md for the full method reference.

Method availability is adapter-specific. The interface guide includes a method matrix so callers can distinguish spot-only, futures-only, and DeFi-only methods.

Tests

npm test

The test suite uses local validation and the Hyperliquid stub, so it can run without real exchange credentials.

On Windows PowerShell, if npm is blocked by execution policy, run:

npm.cmd test

Security Notes

  • Never commit API keys, secrets, private keys, or .env files.
  • Prefer exchange API keys scoped to the minimum required permissions.
  • For DeFi swaps, use execute: false first to inspect the generated transaction before signing.
  • 1inch and Uniswap transactions consume gas and may fail because of slippage, allowance, liquidity, or RPC issues. Handle failed responses before retrying.