Giter Site home page Giter Site logo

sinal2's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sinal2's Issues

能不能关闭掉log?

SinaL2构造函数里面的use_logger传递False进去后,里面的判断逻辑有问题, 为false里面的self.logger 不初始化,后面用会出错。

但是不停的写文件,太费CPU和内存。一天的数据写下来,几个G!

还有一个问题, SinaL2模块有import dHydra 模块, 如果没有config.json也报错,而实际这边是用不到这个文件的。

BTW, 能不能整理下SinaL2的代码,重构一下,里面太多重复的代码,结构有点乱。

strptime 比较消耗时间,用下面这个替换掉会快很多很多很多

在监控整个市场时,几千只股票,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 的考虑是什么?

SinaL2.zip

附上我整合后的代码,感觉还需要重构一下代码的逻辑。

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.