Created
July 7, 2017 00:20
-
-
Save hamstah/2d4a4a8be57a9b8e94c7a4903d8d8bf8 to your computer and use it in GitHub Desktop.
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
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