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

gdax-ext

v1.0.1

Published

extending the gdax client

Readme

gdax-ext

This is an extension for Coinbase's Node.js library gdax-node.

Additional Features

  • Synced level2 orderbook

Quick Start

Just change the modulename from gdax to gdax-ext and use it like you used gdax-node before.

const Gdax = require('gdax-ext');
const publicClient = new Gdax.PublicClient();

Methods

Level2 Orderbook

L2orderbook is a data structure that can be used to store a local copy of the level2 orderbook.

const orderbook = new Gdax.L2orderbook();

The orderbook has the following methods:

  • state()

Gives the complete book

L2orderbook.state();
  • get(side, count)

Ask for the top (count) entries of a side. If count is not specified the top 5 entries where selected.

L2orderbook.get('buy',6);
  • getSpread()

Returns the spread on the book.

L2orderbook.getSpread();
  • processchanges(change)

Processes the messages (data) from the l2update websocket channel. This automaticaly checks, if this message has to be remove or adds an entry.

L2orderbook.processchanges(data.changes);
  • add(order)

Adds an order to the book.

const order = {
    price: '6452.34',
    size: '0.23245'
};
L2orderbook.add(order);
  • remove(price, side)

Removes an order from the book.

const price = '6452.34';
const side = 'sell'
L2orderbook.remove(price, side);

Level2 Orderbook Sync

L2bookSync creates a local mirror of the level2 orderbook on GDAX using

const orderbookSync = new Gdax.L2bookSync(productID);
  • productID optional - defaults to 'BTC-USD' if not specified.

Events

The following events can be emitted from the L2bookSync:

  • synced when a orderbook is synced
  • synced productID when the book of productID is synced
  • updated when a orderbook is updated
  • updated productID when the book of productID is updated

While productID has to be the name of the productID you specified.

Basic Examples

Get level2 orderbooks syncronisation finished and orderbook updated.

const Gdax = require('gdax-ext');

const productIDs = ['ETH-BTC', 'BTC-USD'];
const orderbookSync = new Gdax.L2bookSync(productIDs);

//sync finished for every books
orderbookSync.on('synced', function(data) {
   console.log('synced book:', data);
   console.log(orderbookSync.books[data].state());
   console.log(orderbookSync.books[data].getSpread());
});

//sync finished for one book
orderbookSync.on('synced BTC-USD', function(data) {
   console.log('synced book:', data);
   console.log(orderbookSync.books['BTC-USD'].state());
});

//update for every book
orderbookSync.on('updated', function(data) {
   console.log('updated book:', data);
   console.log(orderbookSync.books[data].getSpread());
});

//update for one book
orderbookSync.on('updated BTC-ETH', function(data) {
   console.log('updated book:', data);
   console.log(orderbookSync.books[data].get('buy',6));
   console.log(orderbookSync.books[data].getSpread());
});

Data contains the productID.