Coder Social home page Coder Social logo

huobi's Issues

交易客户端实现

WebSocketApp.run_forever()会进入无限循环,如果要和客户端(PyQt)比如进行交互(展示KLine,发送新的订阅请求给服务器)时,如何处理更好呢?使用QLocalSocket?或者有更合适的方案。谢谢!
默认情况下,WebSocketApp发送不是线程安全的,意味不加锁情况下不能在一个线程发送心跳包,另外一个线程发送请求。

websocket not working with the compressed data

Exception has occurred: websocket._exceptions.WebSocketConnectionClosedException
socket is already closed.
File "/Users/xxx/Projects/qf/questrade/questrade-model-decision/env/lib/python3.7/site-packages/websocket/_socket.py", line 114, in send
raise WebSocketConnectionClosedException("socket is already closed.")
File "/Users/xxx/Projects/qf/questrade/questrade-model-decision/env/lib/python3.7/site-packages/websocket/_core.py", line 437, in _send
return send(self.sock, data)
File "/Users/xxx/Projects/qf/questrade/questrade-model-decision/env/lib/python3.7/site-packages/websocket/_core.py", line 268, in send_frame
data = data[l:]
File "/Users/xxx/Projects/qf/questrade/questrade-model-decision/env/lib/python3.7/site-packages/websocket/_core.py", line 242, in send
return self.send_frame(frame)
File "/Users/xxx/Projects/qf/questrade/questrade-model-decision/env/lib/python3.7/site-packages/websocket/_app.py", line 153, in send
if not self.sock or self.sock.send(data, opcode) == 0:
File "/Users/xxx/Projects/qf/questrade/questrade-model-decision/env/lib/python3.7/site-packages/huobitrade/service.py", line 47, in send_message
self.ws.send(msg_json)
File "/Users/xxx/Projects/qf/questrade/questrade-model-decision/env/lib/python3.7/site-packages/huobitrade/service.py", line 213, in sub_kline
self.send_message(msg)
File "/Users/xxx/Projects/qf/questrade/questrade-model-decision/tmp.py", line 8, in
hb.sub_kline('ethbtc', '1min') # 订阅数据
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)

Seems the data from huobi is compressed,

"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x00\xabV*\xc8\xccKW\xb2245636\xb14643\xb74\xae\x05\x00m\xe4\xba]\x16\x00\x00\x00"

is

{"ping":1536349316793}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.