bitrich-info / xchange-stream

XChange-stream is a Java library providing a simple and consistent streaming API for interacting with Bitcoin and other crypto currency exchanges via WebSocket protocol. It is build on top of of XChange library providing new interfaces for streaming API. User can subscribe for live updates via reactive streams of RxJava library.
Apache License 2.0
416 stars 219 forks source link

Poloniex Websocket provided too old data. #21

Closed and1player closed 6 years ago

and1player commented 6 years ago

I use xchange-stream lib for Polonix websocket. It's works! But that provides too old Orderboox and Trade data.

For example I have received 30. OCT Trade Data as ETH/BTC. How can i fix it?

lukaszaoralek commented 6 years ago

Maybe I wrong, but if I look at the code around getOrderBook method I see possibly performance bottleneck in MinMaxPriorityQueueUtils class that sorting the list of bid and ask levels every time. I'm just testing GDAX (orderbook snapshot has more then 8k bids!) and Bitfinex market data implementation for exchange-stream. In my case I'm using simply TreeMap. The TreeMap is always sorted according to the natural ordering of its keys. Therefore it's not necessarily sort all bids and asks of the orderbook again when it receives "modify event" and it's still running real-time.

and1player commented 6 years ago

Thank you for your help. I understand what you say. But Below code is not provides array data. Orderbook is same too.

StreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(PoloniexStreamingExchange.class.getName());
        exchange.connect().blockingAwait();

        exchange.getStreamingMarketDataService().getTrades(CurrencyPair.BTC_USD).subscribe(trade -> {
            System.out.println("TRADE: {}" + trade);
        }, throwable -> LOG.error("ERROR in getting trades: ", throwable));
lukaszaoralek commented 6 years ago

Ok, I've rewritten poloniex streaming by using api v2 (the version what it is used on their webpage, wss://api2.poloniex.com). You can try/test it if you want from my fork (branch poloniex) Poloniex2. I'd like to prepare PR of this new version but it depends on "live" PR (https://github.com/bitrich-info/xchange-stream/pull/22). Therefore the code can be changed in the near future. Let me know your feedback if you are going to test it. :)

lukaszaoralek commented 6 years ago

The PR #26

dozd commented 6 years ago

@and1player Is it fixed with v2 api?

dozd commented 6 years ago

Closed for no response.