修复stock.get_quote_history无法获取数据或数据异常 #134
Open
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)
可返回结果:
![image](https://private-user-images.githubusercontent.com/6481352/250856102-bb44f574-88fe-43eb-8af6-668babc7fe92.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4NDY4ODksIm5iZiI6MTczOTg0NjU4OSwicGF0aCI6Ii82NDgxMzUyLzI1MDg1NjEwMi1iYjQ0ZjU3NC04OGZlLTQzZWItOGFmNi02NjhiYWJjN2ZlOTIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMThUMDI0MzA5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OWY1N2M3MTFmYjA4ODExOWNiMzNiOTRhMTFjYTAyMjFmYzI4YTEyZTBkNDJjNjk5NThjOTRlYTdkY2U5YmY0NCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.T-fnVqtnYAz3-MaxIO_1TCy0URswiyoYvqbKADWOzXE)
新增:
ef.stock.get_quote_history 可以传入 lmt 值来控制返回的数量