knowm / XChange

XChange is a Java library providing a streamlined API for interacting with 60+ Bitcoin and Altcoin exchanges providing a consistent interface for trading and accessing market data.
http://knowm.org/open-source/xchange/
MIT License
3.87k stars 1.94k forks source link

[Binance] Kline class cast exception #4877

Open dbof10 opened 5 months ago

dbof10 commented 5 months ago
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')
        at org.knowm.xchange.binance.dto.marketdata.BinanceKline.<init>(BinanceKline.java:42) ~[xchange-binance-5.1.1.jar:na]
        at org.knowm.xchange.binance.service.BinanceMarketDataServiceRaw.lambda$klines$3(BinanceMarketDataServiceRaw.java:83) ~[xchange-binance-5.1.1.jar:na]
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
        at org.knowm.xchange.binance.service.BinanceMarketDataServiceRaw.klines(BinanceMarketDataServiceRaw.java:84) ~[xchange-binance-5.1.1.jar:na]

so this line this.closed = (Boolean)obj[11]; not works

rizer1980 commented 5 months ago

There was already a message somewhere about the same problem, I can’t find it. needs to make BinanceMarketData getKlines method