hadrianl / huobi Goto Github PK
View Code? Open in Web Editor NEW火币的行情交易的python实现
License: MIT License
火币的行情交易的python实现
License: MIT License
请问 可以获取实时合约数据吗
Trade Detail返回的数据msg['tick‘]['data’]列表中的‘id‘字段因为是整数,太长导致插入MongoDB时会报错,得转为str再插入
而且into_db中对depth的数据没处理呀
如果遇到websocket-client报错,请先检查huobitrade版本与websocket-client,请检查是否符合下方两者之一:
1.huobitrade<=0.4.4, websocket-client=0.48
2.huobitrade>=0.4.5, websocket-client>=0.53
这是由于websocket-client从0.48到0.53中的某一版本更改了类方法的消息处理函数,详看websocket-client/websocket-client@f9de412#diff-afdc8659472527a33c2249875888fd1a
WebSocketApp.run_forever()
会进入无限循环,如果要和客户端(PyQt
)比如进行交互(展示KLine,发送新的订阅请求给服务器)时,如何处理更好呢?使用QLocalSocket
?或者有更合适的方案。谢谢!
默认情况下,WebSocketApp
发送不是线程安全的,意味不加锁情况下不能在一个线程发送心跳包,另外一个线程发送请求。
接收不到的时候,进程还在,但是并没有执行对应的callback方法,这个是怎么回事?
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}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.