emptyset110 / sinal2 Goto Github PK
View Code? Open in Web Editor NEWLevel2 from dHydra
License: Apache License 2.0
Level2 from dHydra
License: Apache License 2.0
SinaL2构造函数里面的use_logger传递False进去后,里面的判断逻辑有问题, 为false里面的self.logger 不初始化,后面用会出错。
但是不停的写文件,太费CPU和内存。一天的数据写下来,几个G!
还有一个问题, SinaL2模块有import dHydra 模块, 如果没有config.json也报错,而实际这边是用不到这个文件的。
BTW, 能不能整理下SinaL2的代码,重构一下,里面太多重复的代码,结构有点乱。
I want to monitor the whole market, so I set Symbols=None.
But I get timeout error messages (get_today_all). Could you please take a look?
在监控整个市场时,几千只股票,strptime对性能的影响还是很大的,因为日期和时间字符串格式是固定的,用下面的函数替换会快好多倍。
"time":datetime(int(data[4][0:4]), int(data[4][5:7]), int(data[4][8:10]), int(data[3][0:2]), int(data[3][3:5]), int(data[3][6:8])),
1.把所有没有用到的函数变量都去掉了,
2.去掉了所有重复的代码
3.把登录和取数据都整合到SinaL2里面去了
4.基本没有做代码和结构的调整,全部整到一个函数里面了。
5.之前代码会需要本地有sina.json和config.json(import dhydra就会调用), 现在通过参数传递进去,不会生成碍眼的本地文件。
6.loggin我稍微修改了一下。
另外,我个人觉得Trading-time 没必要添加到里面去,尽量保持数据的原始值。外部调用的可以自己去判断。
另外一个问题:对于全市场差不多3000只股票,我现在是可以全部推送,但是看代码里面,每个线程分配了64个,这样差不多要建50个ws连接,会不会太多。我尝试修改为300,好像也没问题。不知道你当时设置64 的考虑是什么?
附上我整合后的代码,感觉还需要重构一下代码的逻辑。
比如,
sina_l2 = SinaL2(symbols=["sz000001"], on_recv_data = on_recv_data)
sina_l2.start()
然后,我现在不想监听这个了,我想换成另外一个 symbollist
目前,好像没有看到接口来处理这个事情。
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.