mintpaljs

1.0.0 • Public • Published

MintPalJS

Asynchronous wrapper for the MintPal API.

Usage

Add 'mintpaljs' to the dependencies section of your projects package.json

"dependencies": {
  "mintpaljs": "*",
  ...
}

Install using npm

npm install

Use in your project

var mintpal = require('mintpaljs');

Links

Source

git clone git://iquidus.co.nz/mintpaljs.git

Example code (this site)

git clone git://iquidus.co.nz/mintpaljs-example.git

Functions

get_summary

Provides an overview of [exchange] markets. Data refreshes every minute.

mintpal.get_summary(exchange, callback);

Requires: exchange: ('BTC', 'LTC', '')
Returns: callback(error, summary)

note: '' will return results for all markets (both BTC and LTC)

summary is an array of objects structured as:

[{
   "market_id":"25",
   "code":"AUR",
   "exchange":"BTC",
   "last_price":"0.04600001",
   "yesterday_price":"0.04300000",
   "change":"+6.98",
   "24hhigh":"0.04980000",
   "24hlow":"0.04000050",
   "24hvol":"21.737"
   "top_bid":"0.04590000"
   "top_ask":"0.04600005"
},
...
]

get_stats

Provides the statistics for a single market. Data refreshes every minute.

mintpal.get_stats(coin, exchange, callback);

Requires: coin: e.g 'AUR'; exchange: ('BTC' or 'LTC')
Returns: callback(error, stats)

stats is an object structured as:

{
  "market_id":"25",
  "code":"AUR",
  "exchange":"BTC",
  "last_price":"0.04600001",
  "yesterday_price":"0.04300000",
  "change":"+6.98",
  "24hhigh":"0.04980000",
  "24hlow":"0.04000050",
  "24hvol":"21.737"
  "top_bid":"0.04590000"
  "top_ask":"0.04600005"
}

get_trades

Fetches the last 100 trades for a given market.

mintpal.get_trades(coin, exchange, callback);

Requires: coin: e.g 'AUR'; exchange: ('BTC' or 'LTC')
Returns: callback(error, trades)

trades is an array of objects structured as:

[{
   "count":"100",
   "trades":[{
      "type":"1",
      "price":"0.00000023",
      "amount":"412128.80177019",
      "total":"0.09478962",
      "time":"1394498289.2727"
   },
   ...
}]

note: Type 0 refers to a BUY and type 1 refers to a SELL. Time is specified as a unix timestamp with microseconds.

get_orders

Fetches the 50 best priced orders of a given type for a given market.

mintpal.get_orders(coin, exchange, type, callback);

Requires: coin: e.g 'AUR'; exchange: ('BTC' or 'LTC'); type: ('BUY' or 'SELL')
Returns: callback(error, orders)

orders is an array of objects structured as:

[{
   "count":"23",
   "type":"BUY",
   "orders":[{
      "price":"0.00000023",
      "amount":"22446985.14519785",
      "total":"5.16280655"
   },
   ...
}]

note: The orders are kept in the orders.orders array.

get_chartdata

Fetches the chart data that MintPal use for their candlestick graphs for a market for a given time period. The period is an optional parameter and can be either '6hh' (6 hours), '1DD' (24 hours), '3DD' (3 days), '7DD' (1 week) or 'MAX'. If no period is defined, it will default to 6 hours. The market ID can be found by checking the market summary or market stats.

mintpal.get_chartdata(coin, exchange, period, callback);

Requires: coin: e.g 'AUR'; exchange: ('BTC' or 'LTC'); period: e.g '6hh'
Returns: callback(error, chartdata)

chartdata is an array of objects structured as:

[{
   "date":"2014-02-09 14:20",
   "open":"0.00000006",
   "close":"0.00000006",
   "high":"0.00000006",
   "low":"0.00000003",
   "exchange_volume":"0.00002145",
   "coin_volume":"608.50000000"
},
...
]

note: You will most likely need to format chartdata to be compitable with which ever charting libs are used. See example code for jqplot example.

Package Sidebar

Install

npm i mintpaljs

Weekly Downloads

0

Version

1.0.0

License

BSD 3-Clause

Last publish

Collaborators

  • iquidus