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 🙏

© 2024 – Pkg Stats / Ryan Hefner

goxstream

v0.1.1

Published

A node.js readable stream for mtgox. Uses raw websocket!

Downloads

3

Readme

goxstream

Dependency Status

A node.js readable stream for mtgox, based on ws. Reports ticker, depth, trade and lag data in real time. Supports the bitcoin (BTC) channels from this list. Namecoin (NMC) and litecoin (LTC) are currently not traded on MtGox but might be in a near future.

API

goxstream.createStream([opts])

Creates and returns a readable object stream. The options argument configures what type of data you are interested and have the following properties:

  • currency (string) E.g 'USD', 'EUR' etc. Default is 'USD'.
  • ticker (Boolean) Stream ticker data. Default is true.
  • depth (Boolean) Stream depth data, i.e. buys and sells on the market. Default is false.
  • trade (Boolean) Stream trade data, i.e. actual transactions between buyers and sellers. Default is false.
  • lag (Boolean) Stream lag data. Default is false.
  • restart_interval (Number) Time interval in ms. Restart stream after no new data delay. Default is 30000.

goxstream.currencies()

Returns an array of currencies that are available on MtGox.

Examples

Pipe 'USD' ticker data to stdout:

var gox = require('goxstream')
gox.createStream().pipe(process.stdout)

Pipe 'EUR' depth data to file:

var gox = require('goxstream')
var fs  = require('fs')
var options = { currency: 'EUR', ticker: false, depth: true }
gox.createStream(options).pipe(fs.createWriteStream('./EUR'))

Install

npm install goxstream

JSON Format

Here's a brief summary on the different json blobs.

ticker object

All objects under 'ticker' have the same properties as 'high', e.g. 'value', 'value_int' etc

{
    "channel": "d5f06780-30a8-4a48-a2f8-7ed181b4a13f"
  , "channel_name": "ticker.BTCUSD"
  , "op": "private"
  , "origin": "broadcast"
  , "private": "ticker"
  , "ticker": {
        "high": {
            "value": "115.84000"
          , "value_int": "11584000"
          , "display": "$115.84000"
          , "display_short": "$115.84"
          , "currency": "USD"
        }
      , "low": {}
      , "avg": {}
      , "vwap": {}
      , "vol": {}
      , "last_local": {}
      , "last_orig": {}
      , "last_all": {}
      , "last": {}
      , "buy": {}
      , "sell": {}
      , "item": "BTC"
      , "now": "1368096380598414"
    }
}

depth object

{
    "channel": "24e67e0d-1cad-4cc0-9e7a-f8523ef460fe"
  , "channel_name": "depth.BTCUSD"
  , "op": "private"
  , "origin": "broadcast"
  , "private": "depth"
  , "depth": {
        "price": "92"
      , "type": 2
      , "type_str": "bid"
      , "volume": "14.28693815"
      , "price_int": "9200000"
      , "volume_int": "1428693815"
      , "item": "BTC"
      , "currency": "USD"
      , "now": "1368097807984368"
      , "total_volume_int": "84559126689"
    }
}

trade object

{
    "channel": "dbf1dee9-4f2e-4a08-8cb7-748919a71b21"
  , "channel_name": "trade.BTC"
  , "op": "private"
  , "origin": "broadcast"
  , "private": "trade"
  , "trade": {
        "type": "trade"
      , "date": 1368098037
      , "amount": 1.86011338
      , "price": 111.09999
      , "tid": "1368098037413285"
      , "amount_int": "186011338"
      , "price_int": "11109999"
      , "item": "BTC"
      , "price_currency": "USD"
      , "trade_type": "bid"
      , "primary": "Y"
      , "properties": "market"
    }
}

lag object

{
    "channel": "85174711-be64-4de1-b783-0628995d7914"
  , "channel_name": "trade.lag"
  , "op": "private"
  , "origin": "broadcast"
  , "private": "lag"
  , "lag": {
        "qid": "26dc2324-e790-47e8-aef7-e0a1f0633589"
      , "stamp": "1368098833428529"
      , "age":47058
    }
}

License

MIT