CCob / bittrex4j

Java library for accessing the Bittrex Web API's and Web Sockets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

new api?

marslep opened this issue · comments

Hey,
are you using the latest API version?
https://bittrex.github.io/

1.0.9-SNAPSHOT is using the new c2 web socket interface. Hoping to release this week. Your welcome to give snapshot a try

ok. waiting for the new release. thanks :)

Hey,
I'm trying to understand:

public void queryExchangeState(String marketName, UpdateExchangeStateListener updateExchangeStateListener) {
       hubProxy.invoke(LinkedTreeMap.class, "queryExchangeState", marketName)
               .done(exchangeState -> {
                 exchangeState.putIfAbsent("MarketName", marketName);
                 updateExchangeStateListener
                     .onEvent(mapper.readerFor(updateExchangeStateType).readValue(new Gson().toJson(exchangeState)));
               });
 }

Can you please explain me how to use it?

The queryExchangeState call is asynchronous, so typical example would be

bittrexExchage.queryExchangeState("BTC-ETH', exchangeState -> {
    //process exchangeState here
} 

Don't call this function too often though, as it's intensive on the server and Bittrex will ban your IP.

Generally you use this in conjunction with subscribeToExchangeDeltas, once you get a successful subscription you use queryExchangeState to get the current snapshot of the order book, then modify this order book client side, based on the updates you get from queryExchangeState. You will get a nonce value which should be processed in succession. If the nonces go out of sequence you need to start again

Do you have an example for me?

I don't understand how I get the order book json object for example..

You can go far wrong with the code in the samples folder. The library handles all the JSON objects for you and converts them to Java POJO's when the callbacks are called within the onXXX function families

1.0.9 now released with new API support, so I'll close this ticket.