dparlevliet / node.bittrex.api

Node Bittrex API is an asynchronous node.js library for the Bittrex API, the data can be received either via GET request or Stream.
MIT License
253 stars 100 forks source link

Error 503 trying to get candles from Bittrex #61

Open RickPons opened 6 years ago

RickPons commented 6 years ago

I tried to get the candles from bittrex but I got Error 503 always... I opened the website of bittrex and the website ask me for captcha verification. It is the same in all the request I do.

Thanks!

samuelcardillo commented 6 years ago

I am getting the same constantly and sometimes it works. I guess Bittrex is having some issue. The most annoying is that I have no way to catch the exception and act upon it...

dparlevliet commented 6 years ago

Yeah it sounds like we need to put cloudscraper on the normal calls, too - but unfortunately I'm not getting this issue so it'd be hard for me to implement it and know for sure that the issue is solved. Do either of you think you could have a bash at it?

samuelcardillo commented 6 years ago

When you said cloudscraper @dparlevliet I looked at the code of the module I had and that was the problem... It was the deprecated one and not the one from your fork. Removed it and npm i yours instead: working again. I reckon the problem from @RikardoPons comes from that as well.

skyl commented 6 years ago

I get a 503 when I try to connect to the websocket feed: https://github.com/ericsomdahl/python-bittrex/issues/57#issuecomment-343769903

Is anyone else experiencing this?

Did Bittrex just add a connection token to the request? I didn't notice it before:

wss://socket.bittrex.com/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=28%2BotNt6hw6w%2BaNTgvve4ME4aTHBf5Mk2niqkjohrE3yNic3yMX88N8q%2F3DYcoOlNdE4W8tuqy1vR8ssLLaMQ0YKfUkCJ%2B0UsiI%2B8A6b&connectionData=%5B%7B%22name%22%3A%22corehub%22%7D%5D&tid=1
dparlevliet commented 6 years ago

They have enabled cloudflare so you need to connect using cfscraper. Someone has already provided the python code here https://github.com/n0mad01/node.bittrex.api/issues/67#issuecomment-343736593

skyl commented 6 years ago

@dparlevliet wow, thanks. Works perfectly. Where's the tip jar?

dparlevliet commented 6 years ago

Tips are welcomed, just buy any altcoin on the Bittrex market. You'll likely find me in one of them ;)

blockzen commented 6 years ago

Hey anybody know how to apply this fix to the node.js api?

dparlevliet commented 6 years ago

@blockzen it already exists there, check you have the right package and version

RickPons commented 6 years ago

This is the url http://bittrex.com/Api/v2.0/pub/market/GetTicks?marketName=BTC-ZEC&tickInterval=hour

It was working fine but now I got the same issue 403 Forbidden sometimes I get captcha page. This is annoying. does Bittrex support get candles in his Public API? Thanks

blockzen commented 6 years ago

Could anyone help me update my bittrex Api will pay in your choice of crypto. Thanks.

karimhossenbux commented 6 years ago

@blockzen what code do you have right now to get candles?

blockzen commented 6 years ago

not sure what you mean? I don't think im connecting to the server right I get this error in terminal:

{ unhandled_data: {} }

karimhossenbux commented 6 years ago

I meant show us some code to understand what you are trying to do. Not only the response you got from the api

blockzen commented 6 years ago

///////////////bittrex socket connect/////////////////// console.log("position") const websocketsclient = bittrex.websockets.listen( function( data ) { console.log(data); if (data.M === 'updateSummaryState') { data.A.forEach(function(data_for) { data_for.Deltas.forEach(function(marketsDelta) { let pair = marketsDelta.MarketName; let last = parseFloat(marketsDelta.Last); let bid = parseFloat(marketsDelta.Bid); let ask = parseFloat(marketsDelta.Ask); let bittrexObj = {}; bittrexObj['pair'] = pair; bittrexObj['price'] = last; bittrexObj['bid'] = bid; bittrexObj['ask'] = ask; io.emit('bittrex', bittrexObj); }); }); } });

blockzen commented 6 years ago

via websockets

karimhossenbux commented 6 years ago

Could you try something like this:

bittrex.websockets.client(function (wsclient) {
  wsclient.serviceHandlers.connected = function (connection) {
    wsclient.call('CoreHub', 'SubscribeToSummaryDeltas').done(function (err, result) {
      if (err) {
        return console.error(err)
      }
      if (result === true) {
        console.log('Websocket subscribed for ticker')
        bittrex.websockets.listen(function (data, client) {
          if (data.M === 'updateSummaryState') {
            data.A.forEach(function (dataFor) {
              console.log(dataFor)
            })
          }
        })
      }
    })
  }
})