node.bittrex.api icon indicating copy to clipboard operation
node.bittrex.api copied to clipboard

Error 503 trying to get candles from Bittrex

Open RickPons opened this issue 8 years ago • 17 comments

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!

RickPons avatar Nov 11 '17 06:11 RickPons

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...

samuelcardillo avatar Nov 12 '17 09:11 samuelcardillo

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?

dparlevliet avatar Nov 12 '17 10:11 dparlevliet

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.

samuelcardillo avatar Nov 12 '17 10:11 samuelcardillo

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

skyl avatar Nov 12 '17 21:11 skyl

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

dparlevliet avatar Nov 12 '17 21:11 dparlevliet

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

skyl avatar Nov 12 '17 22:11 skyl

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

dparlevliet avatar Nov 12 '17 22:11 dparlevliet

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

blockzen avatar Nov 13 '17 02:11 blockzen

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

dparlevliet avatar Nov 13 '17 03:11 dparlevliet

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

RickPons avatar Nov 20 '17 20:11 RickPons

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

blockzen avatar Dec 09 '17 15:12 blockzen

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

karimhossenbux avatar Dec 09 '17 15:12 karimhossenbux

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

{ unhandled_data: {} }

blockzen avatar Dec 09 '17 15:12 blockzen

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

karimhossenbux avatar Dec 09 '17 15:12 karimhossenbux

///////////////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 avatar Dec 09 '17 15:12 blockzen

via websockets

blockzen avatar Dec 09 '17 15:12 blockzen

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)
            })
          }
        })
      }
    })
  }
})

karimhossenbux avatar Dec 09 '17 15:12 karimhossenbux