修复stock.get_quote_history无法获取数据或数据异常#134
Open
rootphantomer wants to merge 2 commits intoMicro-sheep:mainfrom
Open
修复stock.get_quote_history无法获取数据或数据异常#134rootphantomer wants to merge 2 commits intoMicro-sheep:mainfrom
rootphantomer wants to merge 2 commits intoMicro-sheep:mainfrom
Conversation
|
在 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条左右)。不是说不能获取到数据,而是获取的数据条数过少,导致无法进行使用。 |
Author
原因见:#132 (comment) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复 #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)
可返回结果:

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