mtgoxapi

A Node.js client for MtGox's HTTP API v2.

npm install mtgoxapi
16 downloads in the last week
16 downloads in the last month

mtgoxapi Build Status Coverage Status Code Climate NPM version

A Node.js client for MtGox's HTTP API v2.

This implementation is based on nitrous' unofficial documentation.

Installation

$ npm install mtgoxapi --save

Usage

Node.js

var mtgoxapi = require('mtgoxapi');

API

mtgoxapi.MtGoxClientV2(currency:string, apiKey:string, secret:string) => client:Object

var client = new mtgoxapi.MtGoxClientV2('EUR', 'my_api_key', 'my_secret');

client.add(type:string, amount:number, [price:number], callback:Function) => void

See MONEY/ORDER/ADD

client.add('bid', 50000000, function (error, response) {
    // ...
});

client.add('ask', 50000000, 9250000, function (error, response) {
    // ...
});

client.cancel(id:string, callback:Function) => void

See MONEY/ORDER/CANCEL

client.cancel('123456789-0abc-def0-1234-567890abcdef', function (error, response) {
    // ...
});

client.history(currency:string, [page:number], callback:Function) => void

See MONEY/WALLET/HISTORY

client.history('BTC', function (error, response) {
    // ...
});

client.history('EUR', 2, function (error, response) {
    // ...
});

client.idkey(callback:Function) => void

See MONEY/IDKEY

client.idkey(function (error, response) {
    // ...
});

client.info(callback:Function) => void

See MONEY/INFO

client.info(function (error, response) {
    // ...
});

client.orders(callback:Function) => void

See MONEY/ORDERS

client.orders(function (error, response) {
    // ...
});

client.quote(type:string, amount:number, callback:Function) => void

See MONEY/ORDER/QUOTE

client.quote('bid', 100000000, function (error, response) {
    // ...
});

client.quote('ask', 23769001, function (error, response) {
    // ...
});

client.result(type:string, id:string, callback:Function) => void

See MONEY/ORDER/RESULT

client.result('bid', '123456789-0abc-def0-1234-567890abcdef', function (error, response) {
    // ...
});

client.result('ask', '123456789-0abc-def0-1234-567890abcdef', function (error, response) {
    // ...
});

client.currency(callback:Function) => void

See MONEY/CURRENCY

client.currency(function (error, response) {
    // ...
});

client.fetch(callback:Function) => void

See MONEY/DEPTH/FETCH

client.fetch(function (error, response) {
    // ...
});

client.full(callback:Function) => void

See MONEY/DEPTH/FULL

client.full(function (error, response) {
    // ...
});

client.lag(callback:Function) => void

See MONEY/ORDER/LAG

client.lag(function (error, response) {
    // ...
});

client.ticker(callback:Function) => void

See MONEY/TICKER

client.ticker(function (error, response) {
    // ...
});

client.tickerFast(callback:Function) => void

See MONEY/TICKER_FAST

client.tickerFast(function (error, response) {
    // ...
});

Running the tests

To run the test suite first install the development dependencies:

$ npm install

then run the tests:

$ npm test

License

Licensed under the MIT license.

npm loves you