@kokosro/kraken-api
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@kokosro/kraken-api

Compatible with Kraken API Websockets 1.7.0

Configure

const config = {
      credentials: { secret , key },
      pairs: [ ... ], // list of pairs to listen
      depth: 25, // orderbook depth
      ordersRef: 0, // orders will be open with the reference
      autoConnect: false // automatically connects to server
      cancelOrdersOnProcessExit: true // defaults to false. issues a cancellAllOrders on SIGINT
      debug
};

Initialize

const Kraken = require('@kokosro/kraken-api');
const kraken = new Kraken(config);

kraken.init().then(()=>{
        // websocket connects should be opened
}).catch(console.error);

Init Pair

Pairs can be initiated on instance creation or by using .initPair(pair) method

Create Order

.addOrder(orderInfo) orderInfo

known live orders

  • .orders

Cancel Order

Cancel a specific orders by providing their order ids .cancelOrder(...orderids)

when no orderids are provided it will try and cancel any live orders craeted by the instance ordersRef

Cancel all orders

.cancelAllOrders() - will cancel all live orders created by the instance ordersRef

Orderbook

.orderbook(pair) - will return the current orderbook of the pair

Bests

.bests() - will return a snapshot of best prices for all pairs

Events emitted

  • ready
  • orderbook-change { pair, bids, asks, time }
  • first-level-price-change { pair, side, current, previous }
  • public-trade { pair, price, volume, side, orderType }
  • own-trade trade
  • order-found orderId, orderInfo
  • order-change orderId, orderInfo
  • order-status orderId, orderInfo

Readme

Keywords

none

Package Sidebar

Install

npm i @kokosro/kraken-api

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

79.1 kB

Total Files

38

Last publish

Collaborators

  • kokosro