Coder Social home page Coder Social logo

node.bittrex.api's Introduction

n0mad01's GitHub stats

node.bittrex.api's People

Contributors

192-sean avatar apense avatar caffeinewriter avatar dparlevliet avatar mhuggins avatar n0mad01 avatar nellywhads avatar samuelhei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node.bittrex.api's Issues

How to WS SubscribeToUserDeltas?

Hi!
From what I see here: https://www.bittrex.com/signalr/hubs
and here: #23
Bittrex SignalR has SubscribeToUserDeltas, but I can't see any code able to subscribing to user deltas and do the auth over ws in node.bittrex.api package...

 var setConnectedWs = function(markets) {
    wsclient.serviceHandlers.connected = function(connection) {
      markets.forEach(function(market) {
        wsclient.call('CoreHub', 'SubscribeToExchangeDeltas', market).done(function(err, result) {
          if (err) {
            return console.error(err);
          }

          if (result === true) {
            ((opts.verbose) ? console.log('Subscribed to ' + market) : '');
          }
        });
      });
      ((opts.verbose) ? console.log('Websocket connected') : '');
    };
  };

It only subscribes to exchange deltas upon connecting. Do you have plans/know how to implement the authenticated part of their SignalR API? This is not documented anywhere.

Websocket question

Hi,
I would like to know if there is a way with the new websocket api to be notified when one of my orders has been filled. Is there something else besides 'updateSummaryState'?

I found this snippet in your examples folder

websocketsclient.serviceHandlers.messageReceived = function (message) {
  console.log(message);
}

could this be used in some way? Should I use one of the listen or subscribe events?
Thank you

ImmediateOrCancel (FOK) Orders

Hi, I have been trying to put FOK orders using buylimit and selllimit without success. Do you know if this is actually implemented?

'marketsummaries' will not stream when bittrex.options : stream = true

When I use the following code to 'getmarketsummaries':

    var bittrex = require('/node.bittrex.api/node.bittrex.api.js');
    bittrex.options({
        'stream' : true,
	'verbose' : true,
	'cleartext' : false,
	'baseUrl' : 'https://bittrex.com/api/v1.1'
    });
    bittrex.getmarketsummaries(function(data) {
	for (var i in data.result) {
	    var mrkt = {
		symbol : data.result[i].MarketName,
		volume : data.result[i].Volume,
		last : data.result[i].Last,
		high : data.result[i].High,
		low : data.result[i].Low
		};
	console.log(mrkt);
	};
    });

I get the following response only:

    > streamed from https://bittrex.com/api/v1.1/public/getmarketsummaries in: 0.14s
    streamed from https://bittrex.com/api/v1.1/public/getmarketsummaries in: 0.156s
    streamed from https://bittrex.com/api/v1.1/public/getmarketsummaries in: 1.063s

If I change option stream to false, I get an array of objects with correct results. (far too many to show).
If I am approaching this wrong, please let me know.
Thanks,

'INVALID SIGNATURE'

Hi

If i try request my balance from bittrex i have this error :
{ success: false, message: 'INVALID SIGNATURE', result: null }

How can i fix this??

Websocket API

Hey,

I needed access to the Bittrex real-time API for market changes/tickers, etc - I couldn't find any nodejs library that supported it and their API documentation doesn't even mention it, but it does exist. Anyway, I needed to figure out how to get access and I thought you could use my findings.

The code isn't implementable as-is but it shouldn't take much more work for you to integrate it. Hope you can make use of it - if not, that's OK too.

npm install --save signalr-client jsonic
var jsonic = require('jsonic');
var signalR = require('signalr-client');


var client = new signalR.client(
  "wss://socket.bittrex.com/signalr",
  ['CoreHub']
);


/**
 * Example data:
 * {
    "MarketName": "BTC-ANS",
    "High": 0.001525,
    "Low": 0.00075611,
    "Volume": 2296953.44814714,
    "Last": 0.0014202,
    "BaseVolume": 2638.26486332,
    "TimeStamp": "2017-06-17T12:04:08.53",
    "Bid": 0.0014361,
    "Ask": 0.0014369,
    "OpenBuyOrders": 1022,
    "OpenSellOrders": 514,
    "PrevDay": 0.000769,
    "Created": "2016-10-26T01:28:31.96"
  }
 */
function tickerUpdate(pairCode, data) {
  console.log('Ticker Update for '+pairCode, data);
};


/**
 * Example data:
 *  {
      "MarketName": "BTC-ETH",
      "Nounce": 661678,
      "Buys": [
        {
          "Type": 1,
          "Rate": 0.0886264,
          "Quantity": 0
        },
        {
          "Type": 1,
          "Rate": 0.08743581,
          "Quantity": 0
        },
        {
          "Type": 1,
          "Rate": 0.08616772,
          "Quantity": 0
        },
        {
          "Type": 1,
          "Rate": 0.08577644,
          "Quantity": 0
        },
        {
          "Type": 1,
          "Rate": 0.08576411,
          "Quantity": 0
        }
      ],
      "Sells": [
        {
          "Type": 0,
          "Rate": 0.13989973,
          "Quantity": 40
        },
        {
          "Type": 2,
          "Rate": 0.1399704,
          "Quantity": 0.10334389
        }
      ],
      "Fills": []
      }
    }
 */
function marketUpdate(pairCode, data) {
  console.log('Market Update for '+pairCode, data);
}


function subscribeToMarkets() {
  [ 'BTC-ETH', 'BTC-SC' ].forEach(function(market) {
    client.call('CoreHub', 'SubscribeToExchangeDeltas', market).done(function(err, result) {
      if (result === true) {
        console.log('Subscribed to ' + market);
      }
    });
  });
};

client.serviceHandlers = {
  bound: function() { 
    console.log("Websocket bound"); 
  },
  connectFailed: function(error) { 
    console.log("Websocket connectFailed: ", error); 
  },
  connected: function(connection) {
    subscribeToMarkets();
    console.log("Websocket connected"); 
  },
  disconnected: function() { 
    console.log("Websocket disconnected"); 
  },
  onerror: function (error) { 
    console.log("Websocket onerror: ", error); 
  },
  messageReceived: function (message) {
    try {
      var data = jsonic(message.utf8Data);
      /**
       * updateSummaryState example:
       * {
          "C": "...",
          "M": [
            {
              "H": "CoreHub",
              "M": "updateSummaryState",
              "A": [
                {
                  "Nounce": 254683,
                  "Deltas": [
                    {
                      "MarketName": "BTC-ANS",
                      "High": 0.001525,
                      "Low": 0.00075611,
                      "Volume": 2296953.44814714,
                      "Last": 0.0014202,
                      "BaseVolume": 2638.26486332,
                      "TimeStamp": "2017-06-17T12:04:08.53",
                      "Bid": 0.0014361,
                      "Ask": 0.0014369,
                      "OpenBuyOrders": 1022,
                      "OpenSellOrders": 514,
                      "PrevDay": 0.000769,
                      "Created": "2016-10-26T01:28:31.96"
                    }, .. ]
                }
              ]
            }
          ]
       }
       * updateExchangeState example:
       * {
          "C": "...",
          "M": [
            {
              "H": "CoreHub",
              "M": "updateExchangeState",
              "A": [
                {
                  "MarketName": "BTC-ETH",
                  "Nounce": 661678,
                  "Buys": [
                    {
                      "Type": 1,
                      "Rate": 0.0886264,
                      "Quantity": 0
                    },
                    {
                      "Type": 1,
                      "Rate": 0.08743581,
                      "Quantity": 0
                    },
                    {
                      "Type": 1,
                      "Rate": 0.08616772,
                      "Quantity": 0
                    },
                    {
                      "Type": 1,
                      "Rate": 0.08577644,
                      "Quantity": 0
                    },
                    {
                      "Type": 1,
                      "Rate": 0.08576411,
                      "Quantity": 0
                    }
                  ],
                  "Sells": [
                    {
                      "Type": 0,
                      "Rate": 0.13989973,
                      "Quantity": 40
                    },
                    {
                      "Type": 2,
                      "Rate": 0.1399704,
                      "Quantity": 0.10334389
                    }
                  ],
                  "Fills": []
                }
              ]
            }
          ]
        }
       */
      if (data && data.M) {
        data.M.forEach(function(M) {
          switch (M.M) {
            case 'updateSummaryState':
              M.A.forEach(function(data) {
                data.Deltas.forEach(function(marketsDelta) {
                  tickerUpdate(marketsDelta.MarketName, marketsDelta);
                });
              });
              break;
            case 'updateExchangeState':
              M.A.forEach(function(data) {
                marketUpdate(data.MarketName, data);
              });
              break;
          }
        })
      } else {
        console.log('Unhandled data', data);
      }
    } catch (e) {
      console.error(e);
    }
    return false; 
  },
  bindingError: function (error) { 
    console.log("Websocket bindingError: ", error); 
  },
  connectionLost: function (error) { 
    console.log("Connection Lost: ", error); 
  },
  reconnecting: function (retry) {
    console.log("Websocket Retrying: ", retry);
    // change to false to stop retrying
    return true;
  }
};

Connection aborted and no reconnect attempt ?

I get this error quite frequently: Connection aborted

It triggers the serviceHandlers.disconnected handler but the error is undefined.

Is there a correct way to trigger a reconnect manually with the disconnected handler ?

Using latest npm version. Any ideas ?

Many thanks

SignalR Websocket subscribe from React App framework: TypeError: WebSocketClient not a constructor.

With the objective of simply testing the websocket subscription for orderbook updates within the ReactJS framework, here are the steps I have taken:

-Used create-react-app to create the app.
-used npm to install the node.bittrex.api module
-added the 'bittrex' client object to the top of the default App.js component and configured options with proper API keys, as in docs
-added a button (with handler, binded to the button according to React docs) to the default App.js main component,
-inside the handler function, initiated the websocket subscription according to the example code in the node.bittrex.api docs.
-npm start

The app loads, but when I press the button, I get an error saying that TypeError Websocketclient() is not a constructor, in the line inside the SignalR.js that creates the websocket connection. Is this because React is using a different websocket module than is expected? What to do?

bittrex.websockets.listen.example.js timing

How to run below each 0.3-0.5 second but same time to get all pairs.

t bittrex = require('../node.bittrex.api');

const websocketsclient = bittrex.websockets.listen ( function( data ) {
  if (data.M === 'updateSummaryState') {
    data.A.forEach(function(data_for) {
      data_for.Deltas.forEach(function(marketsDelta)  { 
        console.log('Ticker Update for '+ marketsDelta.MarketName, marketsDelta);
      });
    });
  }
});

Stolen Bitcoins using API Key

Hello,

Yesterday my 100$ in bitcoins was stolen from my BTC Wallet in Bittrex. I was using your nodejs library to connect to my account and make some tests. I have my account with 2FA to have my API tokens and connect to Bittrex API. I sent a ticket to Bittrex support and the response that:

"I'm sorry that your account has been hacked. Unfortunately, there is nothing we can do to recover your funds. For your protection, we ask traders to set unique complex passwords and enable 2FA to protect their accounts from being hacked in this manner.

This withdrawal was made with your API key, at some point leaked your API key in order for someone to be able to make this withdrawal without having to log into your account. "

How is possible stolen my API tokens from your library???

Regards.

APIKEY_INVALID

I've tried everything possible:

  1. node.bittrex.api
  2. normal request pinging a url
  3. Postman
  4. creating a new account
  5. Creating new keys

but I always end up getting this message:
results {"success":false,"message":"APIKEY_INVALID","result":null}

What am I doing wrong?

getting openOrders without params returns error

Hello,

my understanding was that getopenorders would return all open orders if not given a param.
However, when I call it with a market pair like 'BTC-LTC' I get my open orders for that pair.
When I call it without a param it crashes with the following error:

requested from https://bittrex.com/api/v1.1/market/getopenorders?apikey=...&nonce=1503957130 in: 0.236s
/.../node_modules/node.bittrex.api/node.bittrex.api.js:135
              callback(((opts.cleartext) ? body : result), null));
              ^

TypeError: callback is not a function
    at Request._callback (/...node_modules/node.bittrex.api/node.bittrex.api.js:135:15)
    at Request.self.callback (/.../node_modules/request/request.js:188:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/.../node_modules/request/request.js:1171:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (/.../node_modules/request/request.js:1091:12)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)

I can catch it by wrapping the return in a try/catch but I can't seem to get all my open orders back. Am I missing anything?

Api key invalid after add my key

Hello

After parameters my data and update my keys on admin panel

bittrex.options({
'apikey': '93XXXX012XXXXXXXXXXXXXca1bXXXXXa',
'apisecret': 'a2XXXXXXXXXXXXXXXXX5e4908262',
'cleartext': true,
'baseUrl': 'https://bittrex.com/api/v1.1',
});

When i make a simple call like getBalances
bittrex.getbalance({
currency: 'BTC'
}, function(data, err) {
if (err) {
return console.error(err);
}
console.log(data);
});

I got an error { success: false, message: 'APIKEY_INVALID', result: null }

Can you help me ? i have forgot something ?

Thanks

callback error, data order is inversed

Hello i just noticed that you have ( data, error ) as arguments for your callback functions when node.js "standard" is the opposite, it uses error first. as in: ( error, data ).

By using the standard your functions will be ready to plug 'n play in loads of node.js libraries, like Promises, async and many other "callback hell workarounds" !

Thanks for sharing the repo, i'll be doing more tests during the next several weeks.

getcandles function ignores start timestamp parameter

Whenever I try to call getcandles function and pass yesterday's date as a start timestamp parameter I get candle data from the past ~20 days. Currently, I'm testing this with the example provided in the README file:

bittrex.getcandles({
  marketName: USDT-BTC',
  tickInterval: 'fiveMin', // intervals are keywords
  _: ((new Date()).getTime()/1000)-(300*5) // start timestamp
}, function( data, err ) {
  console.log(err)
  console.log( data.result[0] );
  console.log( data.result[data.result.length-1] );
});

I'm printing out the first and the last elements of candle data array and this is what I get:
First:

{ O: 0.08127543,
  H: 0.08139787,
  L: 0.08127543,
  C: 0.08127543,
  V: 282.73389107,
  T: '2017-08-02T15:40:00', <<
  BV: 22.99200037 }

Last:

{ O: 0.07864,
  H: 0.079,
  L: 0.07852603,
  C: 0.0789999,
  V: 103.9385341,
  T: '2017-08-22T15:30:00', <<
  BV: 8.19657536 }

Questions: How to correctly handle errors

Hi,

I am trying to implement your module, which speeds things up greatly!

What I am trying to solve is to correctly handle errors when it might occur.
Two scenario's I can think of:

  1. HTTP errors (timeout, HTTP 500, 403, etc.)
  2. Json errors (success: false)

Looking at the code and samples, it is not clear to me how the codes responds on those errors, or is this not part of the implementation yet?

Most frameworks I know work, with the "err" param being the first result on the callback, but this not seem to be implemented here.

Can you give an error handling example?
For example on:

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

If not implemented yet, is it somewhere on the roadmap (soon)?
Based on that, some retry mecanism may be build inside this module of on top of this to for example retry a buy or sell if an error occurs.

Functionality of getcandles

I made some tests with the getcandles API but I don't understand the results. Example:

market: 'BTC-LTC'
tickInterval: 'day'
starTimestamp: '2017-08-01T00:00:00.000Z'

If I'm not wrong, from starTimestamp to Now (2017-08-25T00:00:00.000Z) exist 25 days so we must obtain 25 candles because I selected 'day' like tickInterval, but I obtain 1266 candles from these dates: 2014-03-07T00:00:00 to 2017-08-25T00:00:00.

This is my code, where market, tickInterval and startTimestamp are variables, I discovered that
tickInterval could be: 'oneMin', 'fiveMin', 'thirtyMin, 'hour', 'day'.

startTimestamp is a Date object of course.

// get timestamp time from startTimestamp
var startTimestamp = startTimestamp.getTime()/1000;

// get candles
bittrex.getcandles({ marketName : market, tickInterval: tickInterval, _: startTimestamp}, function( data, err ) {
            if (err) return cb(err);

            cb(null, data);
        });

The result

{
  "success": true,
  "message": "",
  "result": [
    {
      "O": 0.02525,
      "H": 0.0254,
      "L": 0.02525,
      "C": 0.0254,
      "V": 67.44587598,
      "T": "2014-03-07T00:00:00",
      "BV": 1.70412525
    },
   ...
   ...
{
      "O": 0.01152093,
      "H": 0.011788,
      "L": 0.0113416,
      "C": 0.011691,
      "V": 107397.09516801,
      "T": "2017-08-25T00:00:00",
      "BV": 1241.90857854
    }
  ]
}

What is wrong???

Regards

Websocket API documentation

Hi, I tried to find websocket API documentation in Bittrex but only api I see is RESTFUL.
I want to utilize WSS on these scripts in my python program.
Where can I find it?
I've done Poloniex and Bitfinex but I could not figure out Bittrex.

I use websocket package in python
websocket.WebSocketApp("wss://socket.bittrex.com/signalr",
on_message = on_message,
on_close = on_close,
on_open = on_open)

It disconnect right away. It shows me handshake status 400. I believe I have to send ['CoreHub']
but I can't figure out what is this argument for.
Also when you send command to the server , do you only send {"subscribe":"BTC-USD"}?
If you have some document about socket please share with me.

Thank you for your help.
--EDIT ---
I figured that I have to use signalr and had to change the address https://socket.bittrex.com/signalr (not sure but it connects)
I sent a commmad SubscribeToExchangeDeltas BTC-USD
I don't receive any message nor errors.
I think it is because I dont know what to put in callback function like
client.on('onerror', print_error) "onerror" has to be changed to somethin that server sends.
Can you provide the list of command?
--------------SOLVED------------------------
[(https://github.com/n0mad01/node.bittrex.api/files/1104308/WebSocketAPI_MarketTracking.docx)]
For python use
[https://github.com/TargetProcess/signalr-client-py]

Subscribe to specific channel : SubscribeToExchangeDeltas
Name of the event handler to receive message : updateExchangeState

Thanks.

op.uri does not update, getmarketHistory does not accept count argument

Hey nomad,
I encountered two issues working with your api.

I try to set the count for the getMarketHistory method to anything but 20 but it does not accept the argument and always defaults to 20.
This method seems broken.
Further your op.uri does not update the iteratee in process and always hangs at BTC-ZRC market name as can be seen here at least for the console.log at the end of your pipe.
The iteration itself happens but op.uri does not change. Weird is that the console.log has the count argument correctly in it.
Last, the duration at the end does not seem to be seconds but milliseconds.

streamed from https://bittrex.com/api/v1.1/public/getmarkethistory?market=BTC-ZRC&count=50 in: 4.664s
streamed from https://bittrex.com/api/v1.1/public/getmarkethistory?market=BTC-ZRC&count=50 in: 4.677s
streamed from https://bittrex.com/api/v1.1/public/getmarkethistory?market=BTC-ZRC&count=50 in: 4.697s
streamed from https://bittrex.com/api/v1.1/public/getmarkethistory?market=BTC-ZRC&count=50 in: 4.708s

Your help would be much appreciated in fixing those issues.
Thank you very much for this library.

Sven

Meaning of H and "Nounce" parameters?

In data coming back via web sockets, we see things like this:

{"H":"CoreHub","M":"updateExchangeState","A":[{"MarketName":"USDT-ZEC","Nounce":73530,"Buys":[{"Type":0,"Rate":249.56100001,"Quantity":4.10941386}],"Sells":[{"Type":0,"Rate":253.944,"Quantity":14.903},{"Type":1,"Rate":253.945,"Quantity":0},{"Type":0,"Rate":253.94597411,"Quantity":6.366}],"Fills":[]}]}

What here does "H" stand for, and what other values are there besides CoreHub? Additionally, what does the Nounce value signify?

Any way to monitor orders?

Hi there,

Love this library, really makes stuff straight forward.

Is there any way to retrieve or get notified when an order of mine was filled?

Can't find anything anywhere!

Thanks

connection aborted

I am receiving all ticker as real time via web-socket.
Btw it was writing empty data so I checked console.log
I noticed web-socket connection was disconnected. There was log 'connection aborted'
So I inserted this code...

websocketsclient.serviceHandlers.reconnecting = function (retry) {
	console.log("reconnecting");
	return false;
}

I believe this should reconnect since it is described as that in readme...
But 'connection aborted' was occurred again and it didn't reconnect. stop working...

Please teach me how can i solve this issue...
Thanks in advance

Websocket reconnect?

Thank you for this awesome library!!
Is there a way to automatically reconnect the websocket in case it gets disconnected?

listen example

bittrex.websockets.listen( function( data ) {
  if (data.M === 'updateSummaryState') {
    data.A.forEach(function(data_for) {
      data_for.Deltas.forEach(function(marketsDelta) {
        console.log('Ticker Update for '+ marketsDelta.MarketName, marketsDelta);
      });
    });
  }
});

Currently when it gets disconnected all I see is "Connection aborted" in the console
Thanks in advance! @dparlevliet @n0mad01

websocket API - question

I am using the websockets.subscribe example to get live market data for a specific pair.

Can someone tell me or point me in the right direction regarding the Type values for the Buys and Sells ?

I can see they take values in the 0..2 range, I would like to know what each value means.
I noticed that many, if not all, of the Type = 1 have Quantity = 0. What does this mean?

Thanks!
Alex

Setting the `connected` websocket service handler prevents `updateExchangeState` messages from being received

I'm not sure if this is the right place for this, but I have no idea where else to ask. I've been doing development with this package against the Bittrex API/websocket endpoints all day. I suddenly am no longer getting "updateExchangeState" messages via the websocket. (I'm still receiving "updateSummaryState" messages just fine.) I'm wondering if something changed or broke on their end, something broke in this package (I don't think that's the case since I tried various versions), or if perhaps I got throttled.

Unknonw error

group
I'm getting this error. I was wondering if it's because I'm using it on the client side of JS, not node.

Thanks

error first callback

Hello,

First, thanks for your library!

I saw something which breaks promisify and the bluebird.fromCallback

A lot of libraries follow the error first callback

I want to make a pull request about that, but I want first to know if it's something mergeable for you or not

Thanks by advance for your answer

TypeError: callback is not a function

   account.bittrex.buylimit( {market:currencyPair, quantity: account.staking/values.wa5min , rate : values.wa5min * 1.02}, (res, err) => {
            if (err) {
                    console.log(err);
            } else if (res) {
                   console.log(res);

occasionally yields

/home/ubuntu/node_modules/node.bittrex.api/node.bittrex.api.js:131
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: callback(null, result));
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: ^
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: TypeError: callback is not a function
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: at Request._callback (/home/ubuntu/node_modules/node.bittrex.api/node.bittrex.api.js:131:17)
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: at Request.self.callback (/home/ubuntu/node_modules/request/request.js:188:22)
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: at emitTwo (events.js:87:13)
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: at Request.emit (events.js:172:7)
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: at Request. (/home/ubuntu/node_modules/request/request.js:1171:10)
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: at emitOne (events.js:77:13)
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: at Request.emit (events.js:169:7)
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: at IncomingMessage. (/home/ubuntu/node_modules/request/request.js:1091:12)
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: at IncomingMessage.g (events.js:260:16)
Aug 13 09:56:47 ip-172-31-40-182 bot_USDT-NEO[972]: at emitNone (events.js:72:20)

this results in my code not acknowledging a buy order

best regards :)

"depth" parameter for getorderbook method has no effect

When calling the getorderbook method like in the example :
bittrex.getorderbook({ market : 'BTC-LTC', depth : 10, type : 'both' }, function( data, err ) {console.log( data );});
, the depth parameter does not have an effect on the returned value. Whether depth is 1, 10, or 99, getorderbook() returns what seems to be the entire orderbook (~1400 orders for LTC).

Browser Support / Webpack

Do you plan to port library to a browser environment (or accept a pull request by someone doing this)?
Webpack bundles it with errors, but the resulting script throws:

index.js:31051 Uncaught Error: Cannot find module "net"
    at webpackMissingModule (index.js:31051)
    at Object.module.exports.isString (index.js:31051)
    at __webpack_require__ (index.js:20)
    at Object.module.exports.module.deprecate (index.js:21518)
    at __webpack_require__ (index.js:20)
    at Object.<anonymous> (index.js:30874)
    at __webpack_require__ (index.js:20)
    at index.js:30554
    at Object.<anonymous> (index.js:30847)
    at __webpack_require__ (index.js:20)

Maybe browserify may handle it better, haven't checked.

webpack --debug --env=dev
$ webpack --debug --env=dev

Hash: 3477cbf509fd7c6ac145
Version: webpack 3.3.0
Time: 11910ms
               Asset     Size  Chunks                    Chunk Names
    ./dist//index.js  2.24 MB       0  [emitted]  [big]  ./dist/
./dist//index.js.map  2.82 MB       0  [emitted]         ./dist/
   [9] (webpack)/buildin/global.js 509 bytes {0} [built]
  [81] (webpack)/buildin/module.js 517 bytes {0} [built]
 [143] ./node_modules/ajv/lib 160 bytes {0} [optional] [built]
 [154] multi ./src/index.js 28 bytes {0} [built]
 [155] ./src/index.js 282 bytes {0} [built]
 [316] ./node_modules/ajv/lib/compile 160 bytes {0} [optional] [built]
    + 364 hidden modules

WARNING in ./node_modules/ajv/lib/async.js
96:20-33 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/ajv/lib/async.js
119:15-28 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/ajv/lib/compile/index.js
13:21-34 Critical dependency: the request of a dependency is an expression

ERROR in ./node_modules/JSONStream/index.js
Module parse failed: /home/ilyaigpetrov/Repos/bittrex-assistant/node_modules/JSONStream/index.js Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.
| #! /usr/bin/env node
| 
| 'use strict'
 @ ./node_modules/node.bittrex.api/node.bittrex.api.js 15:17-38
 @ ./src/index.js
 @ multi ./src/index.js

ERROR in ./node_modules/request/lib/har.js
Module not found: Error: Can't resolve 'fs' in '/home/ilyaigpetrov/Repos/bittrex-assistant/node_modules/request/lib'
 @ ./node_modules/request/lib/har.js 3:9-22
 @ ./node_modules/request/request.js
 @ ./node_modules/request/index.js
 @ ./node_modules/node.bittrex.api/node.bittrex.api.js
 @ ./src/index.js
 @ multi ./src/index.js

ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'net' in '/home/ilyaigpetrov/Repos/bittrex-assistant/node_modules/forever-agent'
 @ ./node_modules/forever-agent/index.js 6:10-24
 @ ./node_modules/request/request.js
 @ ./node_modules/request/index.js
 @ ./node_modules/node.bittrex.api/node.bittrex.api.js
 @ ./src/index.js
 @ multi ./src/index.js

ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'tls' in '/home/ilyaigpetrov/Repos/bittrex-assistant/node_modules/forever-agent'
 @ ./node_modules/forever-agent/index.js 7:10-24
 @ ./node_modules/request/request.js
 @ ./node_modules/request/index.js
 @ ./node_modules/node.bittrex.api/node.bittrex.api.js
 @ ./src/index.js
 @ multi ./src/index.js

ERROR in ./node_modules/tough-cookie/lib/cookie.js
Module not found: Error: Can't resolve 'net' in '/home/ilyaigpetrov/Repos/bittrex-assistant/node_modules/tough-cookie/lib'
 @ ./node_modules/tough-cookie/lib/cookie.js 32:10-24
 @ ./node_modules/request/lib/cookies.js
 @ ./node_modules/request/index.js
 @ ./node_modules/node.bittrex.api/node.bittrex.api.js
 @ ./src/index.js
 @ multi ./src/index.js

ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'net' in '/home/ilyaigpetrov/Repos/bittrex-assistant/node_modules/tunnel-agent'
 @ ./node_modules/tunnel-agent/index.js 3:10-24
 @ ./node_modules/request/lib/tunnel.js
 @ ./node_modules/request/request.js
 @ ./node_modules/request/index.js
 @ ./node_modules/node.bittrex.api/node.bittrex.api.js
 @ ./src/index.js
 @ multi ./src/index.js

ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'tls' in '/home/ilyaigpetrov/Repos/bittrex-assistant/node_modules/tunnel-agent'
 @ ./node_modules/tunnel-agent/index.js 4:10-24
 @ ./node_modules/request/lib/tunnel.js
 @ ./node_modules/request/request.js
 @ ./node_modules/request/index.js
 @ ./node_modules/node.bittrex.api/node.bittrex.api.js
 @ ./src/index.js
 @ multi ./src/index.js

npm ERR! Linux 4.8.0-58-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build:dev"
npm ERR! node v6.11.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build:dev: `webpack --debug --env=dev`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] build:dev script 'webpack --debug --env=dev'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bittrex-assistant package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack --debug --env=dev
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs bittrex-assistant
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls bittrex-assistant
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ilyaigpetrov/Repos/bittrex-assistant/npm-debug.log

TypeError: Cannot read property 'sigBytes' of undefined at Object.a.algo.HMAC.a.lib.Base.extend.init ([...]/npm-container/node_modules/node.bittrex.api/hmac-sha512.js:24:177

I'm running an application on my local machine using OSX without any problems but when deploying to an ubuntu instance i'm receiving the following error while trying to use the api:

    TypeError: Cannot read property 'sigBytes' of undefined
        at Object.a.algo.HMAC.a.lib.Base.extend.init (/bundle/bundle/programs/server/npm/npm-container/node_modules/node.bittrex.api/hmac-sha512.js:24:177)

any suggestions on what might be causing the problem?

How to use with Proxy?

Hi,
I would like to know if there is a way to use proxy with node.bittrex API ?

Thanks!

Unable to make asynchronous requests

I tried to wrap this API with promises so that I can use async/await. I'm trying to hit the same API endpoint with different params in these calls. Unfortunately, the same endpoint is hit repeatedly due to the request_options object being shared between calls.

Bittrex WebSocket API Question

In another recent issue that has been closed (#23), Ilya provides the following code sample for reading market data from the Bittrex WebSocket API:

bittrex.websockets.subscribe(['BTC-NMR'], function(data) {
if (data.M === 'updateExchangeState') {
data.A.forEach(function(data_for) {
console.log(data_for);
});
}
});

However, I also receive websocket data where (data.M === 'updateSummaryState'). Can someone please advise on what 'updateSummaryState' means? Do I need to process these to keep my order book accurate or do I only need to process the 'updateExchangeState' packets?

Thanks for any help,
Tom

withdrawal

how can i withdrawal with the api key?

[Error: socket hang up] code: 'ECONNRESET', sslError: undefined ?

From time to time i'm getting

{ [Error: socket hang up] code: 'ECONNRESET', sslError: undefined }
{ [Error: socket hang up] code: 'ECONNRESET', sslError: undefined }

Any idea of what might be happening?

On a side note, i believe the socket connection shouldn't have been made since i'm not using any socket related features ? ( i'm only checking order book )

this are the options i'm currently using:

    'apikey'    : process.env.BITTREX_KEY
    'apisecret' : process.env.BITTREX_SECRET
    'stream'    : false
    'verbose'   : false
    'cleartext' : false 

Ticket for a single market

So I'm trying to figure out how to get the status (ticker) of a single market. I can do this via the public api by going to this url https://bittrex.com/api/v1.1/public/getticker?market=BTC-LTC. However, if i want a listen to the changes, like you do with the web socket, i don't see a way to do this.
The code below listens to all the markets, I'm trying to just listen for BTC-LTC. Can this be done ?

  const web = bittrex.websockets.listen( function( data ) {
    if (data.M === 'updateSummaryState') {
      data.A.forEach(function(data_for) {
        data_for.Deltas.forEach(function(marketsDelta) {
          console.log('Ticker Update for '+ marketsDelta.MarketName, marketsDelta);
        });
      });
    }
  });

I catch "Unhandled stream error in pipe" sometimes

I can not determine the method in which it occurs, but sometimes node.js crashes with this message.

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: Unexpected "h" at position 1 in state START
    at Parser.proto.charError (/home/trader/node_modules/node.bittrex.api/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js:84:16)
    at Parser.proto.write (/home/trader/node_modules/node.bittrex.api/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js:112:23)
    at Stream.<anonymous> (/home/trader/node_modules/node.bittrex.api/node_modules/JSONStream/index.js:21:12)
    at Stream.stream.write (/home/trader/node_modules/node.bittrex.api/node_modules/JSONStream/node_modules/through/index.js:26:11)
    at Request.ondata (stream.js:51:26)
    at Request.emit (events.js:95:17)
    at IncomingMessage.<anonymous> (/home/trader/node_modules/node.bittrex.api/node_modules/request/request.js:1263:12)
    at IncomingMessage.emit (events.js:95:17)
    at IncomingMessage.<anonymous> (_stream_readable.js:764:14)
    at IncomingMessage.emit (events.js:92:17)

My options are as follows

bittrexApi.options({
        'apikey': config.bittrex_public_key,
        'apisecret': config.bittrex_private_key,
        'stream': true,
        'verbose': false,
        'cleartext': false
    });

List of requests I made

client.sendCustomRequest('https://bittrex.com/api/v1.1/account/getorderhistory?market='+marketId+'&count=10', function(){
}, true);

client.getmarketsummaries(function(data) {
});

client.getbalances(function (data) {
});

client.getorderbook({market: marketId, depth: 15, type: 'both'}, function(data) {
});

client.sendCustomRequest('https://bittrex.com/api/v1.1/market/getopenorders?market='+marketId, function( data ) {
}, true);

Any ideas why this is happening ?

getorderhistory returns only orders from last 30 days

I just noticed that. I am using this data for calculation but with only a 30 day timeframe it's useless.
Is it bittrex' fault? Or do you have an idea on how to recive all orders?

new Promise((resolve, reject) => bittrex.getorderhistory({market: 'BTC-LTC'},data => {
      if (data instanceof Object)
        resolve(data)
    }))

returns LTC orderHistory but only from the last 30 days.

The docs also don't say that.

new Promise((resolve, reject) => bittrex.getorderhistory({},data => {
      if (data instanceof Object)
        resolve(data)
    }))

returns all orderHistory for ALL currencies but it's capped to 500 entries...

Is 'SubscribeToExchangeDeltas' the only function available via websockets?

Are there any functions other than 'SubscribeToExchangeDeltas' that can be accessed via Websockets. I would ideally like to get the data for /public/getmarkethistory as this gives more information regarding the orders.

It would also be good to get data for:
/public/getmarketsummaries
/public/getticker
without having to do lots of queries via the REST API?
However, it is more important to get the markethistory via websocket.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.