Skip to content

Instantly share code, notes, and snippets.

@willinspire
Forked from hamstah/bittrex.py
Created July 8, 2017 08:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willinspire/d48acabc1debd829054610b18860056a to your computer and use it in GitHub Desktop.
Save willinspire/d48acabc1debd829054610b18860056a 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