Created
November 9, 2018 12:17
-
-
Save ang-st/ae91d0e7c45131ada5e88b5819acbf67 to your computer and use it in GitHub Desktop.
quick snippet to get streaming data from zebitex
This file contains hidden or 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
| import pysher | |
| import sys,time | |
| # Add a logging handler so we can see the raw communication data | |
| import logging | |
| root = logging.getLogger() | |
| root.setLevel(logging.DEBUG) | |
| ch = logging.StreamHandler(sys.stdout) | |
| root.addHandler(ch) | |
| global pysher | |
| pusher = pysher.Pusher('pusher_key', custom_host= 'pusher.zebitex.com')# | |
| def channel_callback(data): | |
| print("Channel Callback: %s" % data) | |
| def connect_handler(data): | |
| channel = pusher.subscribe('market-zrxbtc-global') | |
| channel.bind('order-book', channel_callback) | |
| pusher.connection.bind('pusher:connection_established', connect_handler) | |
| pusher.connect() | |
| while True: | |
| # Do other things in the meantime here... | |
| time.sleep(1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment