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

ccxt-private-ws

v0.2.2

Published

CCXT compatible private websocket client

Readme

CCXT Private Websockts

A JavaScript library for cryptocurrency trading using authenticated websocket connections.

Features

  • Provides data structure compatibility to CCXT.
  • Typescript support
  • Missing websocket features are executed via REST API using CCXT

WARNING THIS PROJECT IS IN AN EARLY STAGE, HAS NO TESTS AND GIVES YOU NO GUARANTEES ON ANYTHING!

Supported Exchanges

| Exchange | Orders | Account | Notes | | :------- | :-----: | :------: | :--------------------------------------- | | Bitfinex | ✅ | ✅ | | Binance | ✅ | ✅ | Order creation/cancellation via REST API | | Kraken | ✅ | ❌ | Order creation/cancellation via REST API |

Installation

yarn install ccxt-private-ws

Examples

Subscribing to order stream

Import the library:

import * as CcxtPrivateWs from 'ccxt-private-ws';

Create an exchange instance using your credentials:

const exchange = new CcxtPrivateWs['bitfinex']({ credentials: { apiKey: 'XXX', secret: 'YYY' } });

Subscribe the channels you are interested in and start the connection.

exchange.subscribeOrders({
  callback: event => console.log(event.type, event.order)
});
exchange.connect();

Creating an order

await exchange.createOrder({
    symbol: 'USDT/USD';
    type: 'limit';
    side: 'buy';
    amount: 1;
    price: 1.001;
})

Canceling an order

await exchange.createOrder({
    id: 'XXXX-XXXX-XXXX-XXXX';
})

API

Exchange Methods

connect(): Promise<void>

Starts the connection to the exchange and does the authentication.

disconnect(): Promise<void>

Stops the connection to the exchange.

subscribeOrders(): void

Enable order update subscription. For each order update an order event is emitted. Subscribe to the order event using exchange.on('order, listener).

subscribeBalances(): void

Enable balance update subscription. For each balance update a balance event is emitted. Subscribe to the balance event using exchange.on('balance, listener).

createOrder?({ order }: { order: OrderInput }): Promise<void>

Creates an order.

cancelOrder?({ id }: { id: string }): Promise<void>

Cancels an order.

createClientId?(): string

Creates an exchange compliant order client id that can be used when calling createOrder.

getName(): string

Returns the lowercase exchange name.

Exchange Events

on(event: 'order', listener: OrderListener): void

Emitted when an order update is received. The listener event contains the full order that has been aggregated over all subsequent updates.

on(event: 'balance', listener: BalanceListener): void

Emitted when a balance update is received. The listener event might only contain the updated balances but will always contain current values for total, used and free.

on(event: 'fullBalance', listener: BalanceListener): void

Emitted when a balance update is received. This always contains all account balances for the specific exchange. Some exchanges might only send balance events.

on(event: 'connect', listener: ConnectListener): void

Emitted when the websocket connection was established and the authentication succeeded.