Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复stock.get_quote_history无法获取数据或数据异常 #134

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rootphantomer
Copy link

@rootphantomer rootphantomer commented Jul 4, 2023

修复 #130 这个 issue

原因:

当 低于 klt 低于 101 的时候,如 60,30 分钟线,触发的是以下 get 请求
http://35.push2his.eastmoney.com/api/qt/stock/kline/get?secid=1.600900&fields1=f1%2Cf2%2Cf3%2Cf4%2Cf5%2Cf6&fields2=f51%2Cf52%2Cf53%2Cf54%2Cf55%2Cf56%2Cf57%2Cf58%2Cf59%2Cf60%2Cf61&klt=30&fqt=1&end=20500101&lmt=100

根据 url 分析,东方财富要求有个 lmt 参数(limit),同时 beg 和 end 参数不可自选,end 只能取默认最大值 20500101,通过改变 lmt 可以更改近几日的分钟线。目前 lmt 默认是 100

测试 30 分钟线

df = ef.stock.get_quote_history("600900", beg="20200101", end="20230101", klt=30, fqt=1,lmt=100)

可返回结果:
image

新增:

ef.stock.get_quote_history 可以传入 lmt 值来控制返回的数量

@xyz2abc-fintech
Copy link

http://35.push2his.eastmoney.com/api/qt/stock/kline/get?secid=1.600900&fields1=f1%2Cf2%2Cf3%2Cf4%2Cf5%2Cf6&fields2=f51%2Cf52%2Cf53%2Cf54%2Cf55%2Cf56%2Cf57%2Cf58%2Cf59%2Cf60%2Cf61&klt=30&fqt=1&end=20500101&lmt=100 中, 设定lmt=500时,只能获取有限数据(大约是250条左右)。不是说不能获取到数据,而是获取的数据条数过少,导致无法进行使用。

@rootphantomer
Copy link
Author

http://35.push2his.eastmoney.com/api/qt/stock/kline/get?secid=1.600900&fields1=f1%2Cf2%2Cf3%2Cf4%2Cf5%2Cf6&fields2=f51%2Cf52%2Cf53%2Cf54%2Cf55%2Cf56%2Cf57%2Cf58%2Cf59%2Cf60%2Cf61&klt=30&fqt=1&end=20500101&lmt=100 中, 设定lmt=500时,只能获取有限数据(大约是250条左右)。不是说不能获取到数据,而是获取的数据条数过少,导致无法进行使用。

原因见:#132 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants