CCob / bittrex4j

Java library for accessing the Bittrex Web API's and Web Sockets
GNU Lesser General Public License v3.0
32 stars 27 forks source link

BittrexExchange.queryExchangeState fails #26

Closed bezratigreeninvestment closed 6 years ago

bezratigreeninvestment commented 6 years ago

Hey guys,

Been integrating this library into a project of mine. All BittrexExchange class methods that I have used worked flawlessly for me: connectToWebSocket, onOrderStateChange, onBalanceStateChange, onUpdateExchangeState, subscribeToExchangeDeltas.

However, queryExchangeState fails, with this exception: 09:53:33.870 [Thread-8] ERROR com.github.ccob.bittrex4j.BittrexExchange.WebSockets - HubConnection - Error: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at path $

It seems that the full order book response can't be properly parsed. The exception is occurring in the signalr4j v2.0.3 library, class HubProxy, line 157: resultObject = HubProxy.this.mConnection.getGson().fromJson(result.getResult(), resultClass);

The code is trying to parse this payload https://goo.gl/Hyd92B into a com.google.gson.internal.LinkedTreeMap

I tried to manually parse that payload myself by base64 decoding it then unzipping it, but unzipping fails.

Could you please tell me what could be the cause for this issue?

Also, is calling the REST API order book link a viable workaround? Can I use the REST API response nonce to construct my local orderbook with UpdateExchangeState events?

Your help will be most appreciated.

Regards, I.

CCob commented 6 years ago

Great, I'm glad it's working out for you. That issue is fixed in 1.0.10-SNAPSHOT, see #23. I haven't made a 1.0.10 release yet as I haven't had the time. Hopefully this weekend I'll be able to get it done but unfortunately my paid job is taking up more time that I'd like.

Let me know if 1.0.10-SNAPSHOT works for you too.

bezratigreeninvestment commented 6 years ago

Wow, that was a quick reply!!! I'll try it out and get back to you.

Best, I.

bezratigreeninvestment commented 6 years ago

It's ALIIIIIIVVVEEEEEEEE!!!!! My God, you guys the bestEST, you made my day. And for that, I just sent a small BTC contribution to the wallet on the repo landing page. Keep up the amazing work! I.

CCob commented 6 years ago

It's only me working on the library, so your donation is certainly appreciated 👍

CCob commented 6 years ago

@bezratigreeninvestment - As you have been so kind to donate, I have just published the official 1.0.10 release which should include the fix for queryExchangeState. So you shouldn't need to use the SNAPSHOT build.

bezratigreeninvestment commented 6 years ago

@CCob, my small gift was really nothing compared to the value of your work. This project has been well written and has tremendous utility. I was wondering, do you have experience programming clients (specially WS) for other major exchanges? Would you consider doing so in exchange of some compensation? Let me know so I can plan my project accordingly. Regards, I.

CCob commented 6 years ago

I have yes. I have created a bot which is not open source that uses the bittrex4j library among others. What exchange are you interested in creating a library for?

bezratigreeninvestment commented 6 years ago

For now I am eyeing Poloniex and Bitstamp. Also Kraken if there's a way to use a WS API (which currently they don't offer). Maybe there are already existing java clients for their REST/WS/FIX apis, I haven't made my research yet, but getting new integrations to work is also a challenge every time. Eventually, I my goal is to integrate with all "legit" exchanges with considerable volume for the "legit" coins.

On Fri, May 25, 2018 at 7:48 AM, CCob notifications@github.com wrote:

I have yes. I have created a bot which is not open source that uses the bittrex4j library among others. What exchange are you interested in creating a library for?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CCob/bittrex4j/issues/26#issuecomment-392028841, or mute the thread https://github.com/notifications/unsubscribe-auth/AabkqnMLytqfgyRBtPW6eeC5LD1l7AHFks5t1-96gaJpZM4UMUKT .

CCob commented 6 years ago

Have you seen XChange - https://github.com/knowm/XChange? It has support for a ton of exchanges via REST. It didn't have Websocket support for bittrex, which is why I created this library