Discrepancy Between yf.download & yf.Ticker().history()
I am looking at Wheat Futures data (ticker=ZWZ22.CBT) & getting a discrepancy when running the following:
yf.Ticker("ZWZ22.CBT").history(interval="1d",period="10d").tail(30)
Returns data including today's trading day 2022-07-18.
Comparing this to:
yf.download('ZWZ22.CBT')
Which doesn't include 2022-07-18. The last day is 2022-07-15.
Why is there this discrepancy?
yfinance doesn't handle timezones well, so often returned data is off by one day. Except when period is specified, then Yahoo handles the timezones.
I have a branch that should fix this but needs volunteers to test before I merge. See https://github.com/ranaroussi/yfinance/issues/954#issuecomment-1182558587
Thank you @ValueRaider for your quick response! I did a bit more testing & it looks like something to do with the start being specified as well:
yf.download("ZWZ22.CBT ZWU22.CBT", interval="1d",period='10d')
This shows correctly, including 2022-07-19 data
The same command with 'start' included:
yf.download("ZWZ22.CBT ZWU22.CBT",start='2022-07-01', interval="1d",period='10d')
Information is the same as above, but does not include 2022-07-19 data.
I am not much of a programmer & have never contributed to open source but would be willing to try to help test if that would be helpful. Any suggestions on how to help?
Click the link. Then just use it, provide feedback.
This should be solved in recent releases.