1.0.1 • Published 6 years ago

itbit v1.0.1

Weekly downloads
46
License
MIT
Repository
github
Last release
6 years ago

itBit

npm version Known Vulnerabilities

This is a node.js wrapper for the private and public methods exposed by the itBit API. You will need have a registered account with itBit and requested API keys to access the private methods.

Please contact help@itbit.com if you are having trouble opening and account and api@itbit.com to request your API key.

Install

npm install itbit

Examples

var ItBit = require('itbit');

var userId = "",
    walletId = "",
    orderId = "";

var itBit = new ItBit({
    key: "",
    secret: "",
    timeout: 20000  // milliseconds
});

itBit.getTicker("XBTUSD").then(function(data) {
    console.log('bid ' + data.bid + ' ask ' + data.ask);
});

itBit.getOrderBook("XBTUSD").then(function(data) {
    console.log('%s bids and %s asks', data.bids.length, data.asks.length);
});

itBit.getWallets(userId).then(function (wallets) {
    // for each wallet
    wallets.forEach(function(wallet) {
        console.log('wallet id %s, account identifier %s', wallet.id, wallet.accountIdentifier);

        // for each currency
        wallet.balances.forEach(function(balance) {
            console.log('currency %s, total %s, available %s', balance.currency, balance.totalBalance, balance.availableBalance);
        });
    });
});

itBit.getWallet(walletId).then(function(wallet) {
        // for each currency
    wallet.balances.forEach(function(balance){
        console.log('currency %s, total %s, available %s', balance.currency, balance.totalBalance, balance.availableBalance);
    });
});

itBit.getWalletBalance(walletId, "XBT").then(function(balance) {
    console.log('total %s, available %s', balance.totalBalance, balance.availableBalance);
});

itBit.addOrder(walletId, "sell", "limit", "0.01", "500", "XBTUSD", null, null).then(function(data) {
    console.log('new order id ' + data.id);
});

itBit.getOrder(walletId, orderId).then(function(data) {
    console.log(data);
});

itBit.cancelOrder(walletId, orderId).then(function(data) {
    console.log(data);
});
1.0.1

6 years ago

1.0.0

6 years ago

0.0.11

6 years ago

0.0.10

7 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago