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 🙏

© 2025 – Pkg Stats / Ryan Hefner

kraken-api-wrapper

v0.2.0

Published

Wrapper for kraken api

Readme

Kraken API Wrapper for Node.js

Lightweight, no external dependencies, callback/promise based wrapper for Kraken exchange platform.

Installing / Getting started

npm i kraken-api-wrapper --save

How to use

const kraken = require('kraken-api-wrapper')() // create wrapper for API 

OR

const kraken = require('kraken-api-wrapper')('public API key', 'API sign key') // create wrapper for API 

In first example you have access ONLY to public methods, in second you can use both public and private methods.

Module API Reference

To know more about Kraken API you can on the official API reference.

  • Module methods:
    • kraken.setPublicKey('new public API key') - change public API key
    • kraken.setSecreteKey('new sign API key') - change API sign key
    • kraken.setOtp('new two factor password') - change/set two-factor auth password
    • kraken.setRequestTime(new timeout) - change request timeout in ms notation (default: 10000)
    • kraken.setApiVersion(new API version) - change API version, (default: 0)

Methods names are similar to methods in API reference.

Providing cb function you will have default node callback based api, if not - promise based. If you don't need to provide any parameters to request, you can set callback function instead of params or call without arguments to have a promise.

IMPORTANT

Private user funding is a tentative API and may be updated in the future. If smth is broken inside this part read API documentation. If changes touch API methods please open issue on github

Examples

Regular usage only public methods:

const kraken = require('kraken-api-wrapper')();

// Get XZECZUSD tradable asset pair
kraken.AssetPairs({ pair: 'XZECZUSD' }, (err, res) => {
  if (err) {
    console.error(err);
    return;
  }

  console.log(res);
});

// Same as previous but based on promise 
kraken.AssetPairs({ pair: 'XZECZUSD' })
  .then(result => console.log(result))
  .catch(err => console.error(err));

Using methods without additional parameters:

const kraken = require('kraken-api-wrapper')();

// Get all tradable asset pairs
kraken.AssetPairs((err, res) => {
  if (err) {
    console.error(err);
    return;
  }
  
  console.log(res);
});

kraken.AssetPairs()
  .then(result => console.log(result))
  .catch(err => console.error(err));

Private methods:

const kraken = require('kraken-api-wrapper')('publicKey', 'signKey');

// Get asset names and balance amount
kraken.Balance((err, res) => {
  if (err) {
    console.error(err);
    return;
  }

  console.log(res);
});

// Get tradable balances 
kraken.TradeBalance({ asset: 'ZUSD' })
  .then(result => console.log(result))
  .catch(err => console.error(err));

Use your own nonce generation method. By default it uses current time stamp.

const kraken = require('kraken-api-wrapper')();

kraken.AssetPairs({ 
  pair: 'XZECZUSD' ,
  nonce: getAlwaysEncreasingCounter() // generator of always increasing counter
})
  .then(result => console.log(result))
  .catch(err => console.error(err));

Set keys for using private methods

const kraken = require('kraken-api-wrapper')();

// Set keys for private API
kraken.setPublicKey('publicKey');
kraken.setSecreteKey('signKey');

// Change request timeout to 5 sec
kraken.setRequestTime(5000)

// Get tradable balances 
kraken.Balance()
  .then(result => console.log(result))
  .catch(err => console.error(err));

TODO

  • Write tests