Created
December 7, 2016 11:37
-
-
Save darden1/ac94f3f0682416c65da7824df87963c9 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