Skip to content

Node Bittrex API is an asynchronous node.js library for the Bittrex API, the data can be received either via GET request or Stream.

License

Notifications You must be signed in to change notification settings

hakabane/node.bittrex.api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node Bittrex API

Node Bittrex API is an asynchronous node.js library for the Bittrex API - https://bittrex.com/. The Bittrex API data can be received either as a GET request or a Stream.

Documentation to the Bittrex API: https://bittrex.com/Home/Api

Installation

install it most convenient via npm:

$ npm install node.bittrex.api
or

fetch the project via git:

$ git clone https://github.com/n0mad01/node.bittrex.api.git

then meet the package dependencies:

$ cd node-bittrex-api/
$ npm install

First steps

include node.bittrex.api.js into your project:

var bittrex = require('./node.bittrex.api.js');
configure
bittrex.options({
    'apikey' : API_KEY,
    'apisecret' : API_SECRET, 
    'stream' : true,
    'verbose' : true,
    'cleartext' : false 
});

By default the returned data is an object, in order to get clear text you have to add the option cleartext (streams will always return objects):

'cleartext' : true

The baseUrl itself can also be set via options

'baseUrl' : 'https://bittrex.com/api/v1'

Streams

To activate Streaming simply add to your options:

'stream' : true

Streaming depends on the following npm packages:

Examples

After configuration you can use the object right away: example #1

bittrex.getmarketsummaries( function( data ) {
    for( var i in data.result ) {
        bittrex.getticker( { market : data.result[i].MarketName }, function( ticker ) {
            console.log( ticker );
        });
    }
});

example #2

bittrex.getbalance({ currency : 'BTC' }, function( data ) {
    console.log( data );
});

Other

Other libraries utilized:

For HmacSHA512 this package is using a part of Crypto.js from google because the node crpyt package could not provide any appropriate result.

Methods

Optional parameters may have to be looked up at https://bittrex.com/Home/Api.

Not all Bittrex API methods are implemented yet (and may never be), also some could have been forgotten in the documentation ( therefore i recomend you to consult the class code ).

Nonetheless the method sendCustomRequest enables completely custom requests anyway.

sendCustomRequest
  • url String
  • callback Function
  • credentials Boolean optional whether the credentials should be applied to the request/stream or not, default is set to false.

example #1

var url = 'https://bittrex.com/api/v1.1/public/getticker?market=BTC-LTC';
bittrex.sendCustomRequest( uri, function( data ) {
    console.log( data );
});

example #2 (credentials applied to request/stream)

bittrex.sendCustomRequest( 'https://bittrex.com/api/v1.1/account/getbalances?currency=BTC', function( data ) {
    console.log( data );
}, true );

will result in (the Header is being set too):
https://bittrex.com/api/v1.1/account/getbalances?currency=BTC&apikey=API_KEY&nonce=4456490600
getticker
bittrex.getticker( { market : 'BTC-LTC' }, function( data ) {
    console.log( data );
});
getbalances
bittrex.getbalances( function( data ) {
    console.log( data );
});
getmarkethistory
bittrex.getmarkethistory({ market : 'BTC-LTC', count : 3 }, function( data ) {
    console.log( data );
});
getmarketsummaries
bittrex.getmarketsummaries( function( data ) {
    console.log( data );
});
getorderbook
bittrex.getorderbook({ market : 'BTC-LTC', depth : 10, type : 'both' }, function( data ) {
    console.log( data );
});
getwithdrawalhistory
bittrex.getwithdrawalhistory({ currency : 'BTC', count : 1 }, function( data ) {
    console.log( data );
});
getdepositaddress
bittrex.getdepositaddress({ currency : 'BTC' }, function( data ) {
    console.log( data );
});
getbalance
bittrex.getbalance({ currency : 'BTC' }, function( data ) {
    console.log( data );
});
donations very welcome!

BTC

1N5T2VYACYKxK3UUDHhp7g69qtUmsDdAjZ

About

Node Bittrex API is an asynchronous node.js library for the Bittrex API, the data can be received either via GET request or Stream.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%