Skip to content

Instantly share code, notes, and snippets.

@ang-st
Created November 9, 2018 12:17
Show Gist options
  • Save ang-st/ae91d0e7c45131ada5e88b5819acbf67 to your computer and use it in GitHub Desktop.
Save ang-st/ae91d0e7c45131ada5e88b5819acbf67 to your computer and use it in GitHub Desktop.
quick snippet to get streaming data from zebitex
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