3

===SIMPLE & SHORT===

Does anybody have working application that talks with Poloniex through WAMP in these days (January, 2018)?

===MORE SPECIFIC===

I used several info sources to make it work using combo: autobahn-cpp & C++. Windows 10 OS. I was able to connect to wss://api.poloniex.com, realm1. Plus I was able to subscribe and get subscription ID. But I never got any events even when everything established.

===RESEARCH===

During research in the web I saw a lot of controversial information:

1. Claims, that wss://api2.poloniex.com should be used, and channels names are actually numbers - How to connect to poloniex.com websocket api using a python library

2. This answer gave me base code, but I am getting anything more than just connections, also by following this answer - wss://api.poloniex.com is correct address - Connecting to Poloniex Push-API

3. I saw post (sorry, lost the link), there were comments made that websockets implementation are basically broken on poloniex. They were posted 6 months ago.

===SPECS===

1. Windows 10

2. Autobahn-Cpp

3. wss://api.poloniex.com:443 ; realm1

4. Different subscriptions: ticker, BTC_ETH, 148, 1002, etc..

5. Source code I got from here

===WILL HELP AS WELL===

  1. Is there any way to get all valid subscriptions or, probably, those, that have more than 0 subscribers? I mean, does WAMP have a way to do that?

  2. Is there any known issues with Autobahn-Cpp and poloniex combo?

  3. Is there any simpler way to test WAMP elsewhere to make sure Autobahn isn't a problem? Like any other well documented & supported online projects that accept WAMP websocket communication?

Anton Kasabutski
  • 355
  • 5
  • 16
  • 1
    fwiw, I was receiving correct data from wss://api2.poloniex.com:443 up until about a week ago, and then something broke. Don't have a solution at this time – onlyvix.blogspot.com Jan 26 '18 at 13:11
  • The same problem. Seems like Poloniex have some problems with their API on the WSS and HTTPS side too. When I make GET requests, they response with 404 error. – Mowshon Jan 26 '18 at 15:23
  • @onlyvix.blogspot.com thank You for response. I would appreciate a lot, if You would update your answer as soon as your solution become valid again. That would give me a reason to be confident at least about using URL and realm in autobahn-cpp. – Anton Kasabutski Jan 27 '18 at 06:38
  • @Mowshon I disagree about HTTPS side. I tried just now their GET request: [try it](https://poloniex.com/public?command=returnOrderBook&currencyPair=BTC_NXT&depth=10). Maybe your IP got banned? – Anton Kasabutski Jan 27 '18 at 06:41
  • Rest api works for me without problems, just ws broke – onlyvix.blogspot.com Jan 27 '18 at 22:15

3 Answers3

1

I can receive the correct tick order book data from wss://api2.poloniex.com use python3 but sometime The channel 1002 may stop sending the new tick info.

Ming Chu
  • 93
  • 7
1

wss://api.poloniex.com:443 ; realm1

This may be the issue as I've been using api2 and here is the code that works, and has been working for the past 2 quarters non-stop. Its in python, but should be easy enough to port to C++.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import websocket
import json

def on_error(ws, error):
    print(error)

def on_close(ws):
    print("### closed ###")
    connection.close()

def on_open(ws):
    print("ONOPEN")
    ws.send(json.dumps({'command':'subscribe','channel':'BTC_ETH'}))

def on_message(ws, message):
    message = json.loads(message)
    print(message)

websocket.enableTrace(True)
ws = websocket.WebSocketApp("wss://api2.poloniex.com/",
                              on_message = on_message,
                              on_error = on_error,
                              on_close = on_close)
ws.on_open = on_open
ws.run_forever()

the code is pretty much self-explanatory (You can check all channels/pairs on Poloniex API website), just save it and run in terminal

python3 fileName.py

should provide You with BTCETH raw stream of orders and trades on console output.

Playing with the message/subscriptions You can then do as You please with it.

0x3W
  • 11
  • 2
0

It seems that websockets in Poloniex are unstable. Therefore I can stop my attempts make Autobahn-Cpp work with it at least by now and move on.

Anton Kasabutski
  • 355
  • 5
  • 16