Last active
May 21, 2018 04:24
-
-
Save icehongssii/5209aa0637318cfb60522c8fdda7b46b to your computer and use it in GitHub Desktop.
Return data from wss.bithumb.com
This file contains 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 websocket #pip install websocket-client | |
import thread | |
import time | |
import json | |
def on_message(ws, message): | |
print(message) | |
def on_error(ws, error): | |
print(error) | |
def on_close(ws): | |
print("### closed ###") | |
def on_open(ws): | |
print("ONOPEN") | |
def run(*args): | |
ws.send(json.dumps({currency: "ETH", tickDuration: "24H"})) | |
while True: | |
time.sleep(1) | |
ws.close() | |
print("thread terminating...") | |
thread.start_new_thread(run, ()) | |
if __name__ == "__main__": | |
websocket.enableTrace(True) | |
ws = websocket.WebSocketApp("wss://wss.bithumb.com/public", | |
on_message = on_message, | |
on_error = on_error, | |
on_close = on_close) | |
ws.on_open = on_open |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment