Skip to content

Instantly share code, notes, and snippets.

@hamstah
Created July 7, 2017 00:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hamstah/2d4a4a8be57a9b8e94c7a4903d8d8bf8 to your computer and use it in GitHub Desktop.
Save hamstah/2d4a4a8be57a9b8e94c7a4903d8d8bf8 to your computer and use it in GitHub Desktop.
from requests import Session # pip install requests
from signalr import Connection # pip install signalr-client
def handle_received(**kwargs):
print('received', kwargs)
def print_error(error):
print('error: ', error)
def main():
with Session() as session:
connection = Connection("https://www.bittrex.com/signalR/", session)
chat = connection.register_hub('corehub')
connection.start()
connection.received += handle_received
connection.error += print_error
for market in ["BTC-MEME", "BTC-ANS"]:
chat.server.invoke('SubscribeToExchangeDeltas', market)
chat.server.invoke('QueryExchangeState', market)
while True:
connection.wait(1)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment