Poloniexはすべてのメッセージを私のソケットに返しません。私は、次のコードでメッセージを読み、時々私は、連続的なメッセージ番号を取得し、時には不足している10件のメッセージのようにあります。誰もがよりよい解決策を知っていPoloniex TrollboxでPython autbahnや他のソケットモジュールを使ってメッセージを読む?
from autobahn.asyncio.wamp import ApplicationSession
from autobahn.asyncio.wamp import ApplicationRunner
from asyncio import coroutine
class PoloniexComponent(ApplicationSession):
def onConnect(self):
self.join(self.config.realm)
@coroutine
def onJoin(self, details):
def onTrollbox(*args):
print("type: ", args[0])
print("message_number: ", args[1])
print("user_name: ", args[2])
print("message: ", args[3])
print("reputation: ", args[4])
try:
yield from self.subscribe(onTrollbox, 'trollbox')
except Exception as e:
print("Could not subscribe to topic:", e)
runner = ApplicationRunner("wss://api.poloniex.com", "realm1")
runner.run(PoloniexComponent)
?私はこの1つを試してみましたが、それがすべてでは動作しません:あなたはここにこのコードを確認することができます私が作った
from websocket import create_connection
ws = create_connection("wss://api.poloniex.com")
ws.send("trollbox")
result = ws.recv()
print "Received '%s'" % result
ws.close()
あなたはウェブサイトのソース[here](https://poloniex.com/js/plx_exchage.js?v=060617)を見て、2294行を見て、trollboxサブスクリプションがコメントされていることを確認することができます。 –