shidenggui / easyhistory Goto Github PK
View Code? Open in Web Editor NEW用于获取维护股票的历史数据
用于获取维护股票的历史数据
目录名easyhistroy, 以及day.py里都有误拼easyhistroy
end_quarter = 5 if str(year) != str(now_year) else math.ceil(now_month / 12) + 1
应该为
end_quarter = 5 if str(year) != str(now_year) else math.ceil(now_month / 3) + 1
bug导致init时取不全数据。
我fork的版本已经改的面目全非了, 就不提交pr了。
导致新的股票,无法下载
我核对过raw_data里面的原始数据是对的,手工除权也是对的,但是在data里面,除权的数据差距较大。
这其实不是easyhistory的错,是request包 内会读取本地用户目录的 .netrc或 _netrc文件内用户名和密码,试图自动完成网站认证过程,但是这个文件是utf8编码的,默认使用当前系统编码gbk去读取,就产生错误,在request项目内,关于 netrce的 issure一大堆,其中 option to disable .netrc #2773。
我现在暂时解决办法是,主动传入用户和密码,这样就不会读取netrc文件了,诸如:
dom = PyQuery(url, auth=('user', 'pass'))
rep = requests.get(url, params, timeout=3, headers=headers, auth=('user', 'pass'))
官方似乎推荐设置 trust_env=false 来解决
line 1:histroy -> history。
感觉有内存泄露之处,取几十只股票的历史数据就看着python消耗的内存涨了3个G,也许是rqalpha的问题:
objgraph.show_growth()
weakref 8820 +1
for i in stock_codes[:20]:
try:
df = easyhistory.history(i[:-5])
except Exception as e:
pass
objgraph.show_growth()
list 469391 +433451
Instrument 193160 +183502
...
easyhistory.history这个方法应该支持获取批量股票信息,并且可以指定时间
这样定义接口比较好
def history(stock_codes, start=None, end=None, market=None, bundle_path='~/.rqalpha/bundle')
最后两行错误是:
File "/home/user/easyhistory/easyhistory/day.py", line 43, in update_single_code
self.store.write(stock_code, updated_data)
File "/home/user/easyhistory/easyhistory/store.py", line 43, in write
updated_data_start_date = updated_data[0][0]
IndexError: list index out of range
然后程序就退出了
File "E:\同步文件夹\02学习资料\Python\easyhistory-master\easyhistory\api.py", line 6, in init
return Day(path=path, export='csv').init(export)
TypeError: init() takes 1 positional argument but 2 were given
前复权只需要对价格进行调整,不需要对成交量/额进行调整
以000039的4月1日数据为例,raw_data的成交量/额/复权因子如下:
17566666 264585488 23.302
data中对这两项都做了复权处理,结果如下,是错的:
753869.45 11354625.7 23.302
股票代码000156更新后只有2016年数据,是来源网站的问题吗?
Where is the .update? I cant find it and download
File "C:\Python\Python36\lib\site-packages\easyhistory\api.py", line 26, in history
d = BaseDataSource(os.path.expanduser(bundle_path))
�[36m | | -> '~/.rqalpha/bundle'�[m
�[36m | -> <module 'os' from 'C:\Python\Python36\lib\os.py'>�[m
�[36m -> <class 'rqalpha.data.base_data_source.BaseDataSource'>�[m
File "C:\Python\Python36\lib\site-packages\rqalpha\data\base_data_source.py", line 44, in init
�[33;1mraise�[m �[35;1mRuntimeError�[m(�[31m'bundle path {} not exist'�[m.format(os.path.abspath))
�[36m -> <module 'os' from 'C:\Python\Python36\lib\os.py'>�[m
RuntimeError: bundle path <function abspath at 0x0000023827DD59D8> not exist
response是空
如题:
我想获取所有股票指定日期区间的数据,并没有从api中找到方法
首先不能获取所有股票,然后不能指定日期区间
应该从summary.date的第二天计算data_quater,
这样可以避免月初更新时重新请求上个季度的数据。
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.