Namibian Pyjama Merchant

    coinbase-pro-feed

    0.1.0 • Public • Published

    coinbase-pro-feed

    Lightweight Coinbase Pro Websocket Feed implementation.

    travis dependencies coverage status linter

    node version license minzip downloads

    Install

    npm install -s coinbase-pro-feed

    .feedFor(product_ids[, options[, env]])

    The feed wraps websocket client using stream.Readable:

    const { feedFor } = require('coinbase-pro-feed')
     
    feedFor(['btc-eur'], { objectMode: false }) // when false
      .pipe(process.stdout)                     // data event invokes raw buffer
     
    feedFor(['btc-eur'], { objectMode: true }) // when true
      .on('data', console.log)                 // data event invokes parsed object
    • product_ids (default: [])
    • options (default: { objectMode = true, channels: ['full'] })
    • env (default: process.env)

    .socketFor(product_ids[, options[, env]])

    The websocket client allows you to connect and listen to exchange messages.

    const { feedFor } = require('coinbase-pro-feed')
     
    socketFor(['btc-eur'], { channels })
      .on('open', () => {
        console.log('open') // socket connected
      })
      .on('data' (data) => {
        console.log('data:', data) // parsed messages
      })
      .on('error', (err) => {
        console.error('error:', err) // socket error
      })
      .on('close', () => {
        console.log('close') // socket closed
      })

    Command Line Interface (CLI)

    When installed globally it is possibile to access the command line interface:

    npm install --global coinbase-pro-feed

    Usage

    coinbase-pro-feed btc-eur eth-eur ltc-eur
     
    # stdout compatible with http://jsonlines.org 

    Install

    npm i coinbase-pro-feed

    DownloadsWeekly Downloads

    6

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    11.4 kB

    Total Files

    7

    Last publish

    Collaborators

    • ivoputzer