1

I am using C# WAMP client to connect to the Poloniex exchange to get the real time Market data.AS per the documentation provided by the exchange in order to create a real time order book we have to first get the snapshot of the order book through REST api provided by them and extract the sequence number from it and then connect to the WAMP server to get the streaming data and update the order book snapshot.

I have problem in updating the snapshot order book received through rest api since the sequence number which I received through the REST api is nearly 400k record ahead of the sequence number received through WAMP.

Is there any other way which I could get the real time Streaming data from the POloniex exchange or am I missing anything?

James Z
  • 12,209
  • 10
  • 24
  • 44
Dhinesh
  • 325
  • 1
  • 6
  • 17

2 Answers2

2

I have the same problem. Seems they have some bug. What I have noticed is that there are different sequences sent in normal update messages and in "heartbeat" messages (the ones without payload). The documentation states that a heartbeat message should repeat the last normal message sequence number. But it differs. However it corresponds to a number returned by REST API. So seems that "works" for heartbeat messages and wrong for normal ones. Looks pretty much as a bug.

Here is also some related question.

UPD: Also checked "newTrade" events with trade history returned by the REST API. Trade IDs in WAMP are significantly lower than actual ones in a snapshot. Seems the events published via push API are outdated by several hours and that is the explanation of all this behaviour. So the push API is unusable now.

And finally, seems that current way to go is using their pure WebSocket API which is used by web-interface. It is located at wss://api2.poloniex.com. The only problem is lack of documentation. One way is reverse engineering the traffic of the web-interface. Some poor pieces of information although can be found in code snippets like this or in discussion here.

vagran
  • 867
  • 1
  • 7
  • 18
0

The original websocket does not seem to be active. The one that is active is indeed: wss://api2.poloniex.com. I am coding my app in swift but maybe you will find this helpful. For orderbook entries I send the following message: "{"command":"subscribe","channel":"(coinPair)"}".

It is very important to use the quotes correctly (as above). The "(coinPair)" is string interpolation so you can include whatever coin pair you want to get the orderbook for. Of course you have to eliminate the (). These are for swift only.

If you want to get a live feed of the prices of all of the tickers you have to send the following message: "{\"command\":\"subscribe\",\"channel\":1002}". Again be careful to use the correct quotes.

Hope this helps.