New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kokosro/kraken-api

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kokosro/kraken-api

Kraken WS API wrapper

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@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

FAQs

Package last updated on 17 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc