-
-
Save windows98SE/9853b7a2fe3ed6dc367b5b3f9ff08a75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.internet.defer import inlineCallbacks | |
from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner | |
import json | |
def onTick(*args): # everytime we get a push message from the polo ticker | |
print(json.dumps(args)) # send json string to stdout | |
class Subscribe2Ticker(ApplicationSession): | |
@inlineCallbacks | |
def onJoin(self, details): | |
yield self.subscribe(onTick, 'ticker') | |
if __name__ == "__main__": | |
subscriber = ApplicationRunner(u"wss://api.poloniex.com:443", u"realm1") | |
subscriber.run(Subscribe2Ticker) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment