Code Monkey home page Code Monkey logo

Comments (11)

mjwchapman avatar mjwchapman commented on September 18, 2024 1

Pull request #117 fixes this issue.

from binance-java-api.

tompee26 avatar tompee26 commented on September 18, 2024

I think the reason here is that Q A v q cannot be parsed as long. Maybe because of a recent update.

from binance-java-api.

MetalMiner avatar MetalMiner commented on September 18, 2024

Yes, I am facing the same issue and it is really annoying. Pleace fix this fast!

from binance-java-api.

MetalMiner avatar MetalMiner commented on September 18, 2024

The problem is the constructor

public BinanceApiWebSocketListener(BinanceApiCallback<T> callback) { this.callback = callback; this.eventTypeReference = new TypeReference<T>() {}; }

You can't get the Typereference of the callback that way. As a quick fix change the onMessage method of the same class as follows:

@Override public void onMessage(WebSocket webSocket, String text) { if (webSocket.request().url().toString().endsWith("ticker@arr")) { eventTypeReference = (TypeReference<T>) new TypeReference<List<AllMarketTickersEvent>>(){}; } ObjectMapper mapper = new ObjectMapper(); try { T event = null; if (eventClass == null) { event = mapper.readValue(text, eventTypeReference); } else { event = mapper.readValue(text, eventClass); } callback.onResponse(event); } catch (IOException e) { throw new BinanceApiException(e); } }

This is only a temporary solution of course.

Furthermore you have to change the type of Q A v q in AllMarketTickersEvent to Double as mentioned before.

from binance-java-api.

joaopsilva avatar joaopsilva commented on September 18, 2024

Hi everyone, I'm unable to reproduce this problem, please make sure you update your repository and you're using the latest version, since there were some recent updates on the websocket-based client.

from binance-java-api.

joaopsilva avatar joaopsilva commented on September 18, 2024

For reference, I'm using Java(TM) SE Runtime Environment (build 1.8.0_60-b27)

from binance-java-api.

MetalMiner avatar MetalMiner commented on September 18, 2024

I think this is an issue related to the Runtime Environment. I switched to yours an it is working fine. When I am using my default which is 1.8.0_144 it is throwing errors. Could you pleace consider testing the API with newer Runtime versions?

from binance-java-api.

0xParts avatar 0xParts commented on September 18, 2024

Have the same problem. Here is another example for a quick fix:

            List<AllMarketTickersEvent> tick = new ArrayList<AllMarketTickersEvent>();
            client.onAllMarketTickersEvent(response -> {
                    String str = response.toString();
                    int i=0, c;
                    for(int x = 0; x < response.size(); x++) {
                            tick.add(new AllMarketTickersEvent());
                            i = str.indexOf('s', i)+2;
                            c = str.indexOf(',', i);
                            tick.get(x).setSymbol(str.substring(i, c));
                            i = str.indexOf('c', i)+2;
                            c = str.indexOf(',', i);
                            tick.get(x).setCurrentDaysClosePrice(Double.parseDouble(str.substring(i, c)));                                                                             
                    }       
            });

from binance-java-api.

gokmenkisakol avatar gokmenkisakol commented on September 18, 2024

Hi, I used this code;

for (Iterator iter = response.iterator(); iter.hasNext(); )
{
ObjectMapper mapper = new ObjectMapper();
AllMarketTickersEvent allMarketTickersEvent = mapper.convertValue(iter.next(), AllMarketTickersEvent.class);
}

from binance-java-api.

wrone avatar wrone commented on September 18, 2024

Still not fixed? Struggling with it 👎

from binance-java-api.

joaopsilva avatar joaopsilva commented on September 18, 2024

This is now fixed, please update your repo.

from binance-java-api.

Related Issues (20)

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.