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

End day data is missing in the resulting DataFrame #1906

Open
ZmicierGT opened this issue Apr 12, 2024 · 1 comment
Open

End day data is missing in the resulting DataFrame #1906

ZmicierGT opened this issue Apr 12, 2024 · 1 comment

Comments

@ZmicierGT
Copy link

ZmicierGT commented Apr 12, 2024

Describe bug

Hi.

I see that the last day data is missing in the resulting DataFrame. For example, if I request data starting from 2020-08-28 till 2020-08-31, there will be no 2020-08-31 in the resulting DataFrame but actually this data exists on Yahoo.

Simple code that reproduces your problem

import yfinance as yf
yf.download('SPY', start="2020-08-28", end="2020-08-31")
[*********************100%%**********************]  1 of 1 completed
                  Open        High         Low       Close   Adj Close    Volume
Date                                                                            
2020-08-28  349.440002  350.720001  348.149994  350.579987  331.563324  48588900

yf.download('SPY', start="2020-08-28", end="2020-09-01")
[*********************100%%**********************]  1 of 1 completed
                  Open        High         Low       Close   Adj Close    Volume
Date                                                                            
2020-08-28  349.440002  350.720001  348.149994  350.579987  331.563385  48588900
2020-08-31  350.350006  351.299988  349.059998  349.309998  330.362244  66099200 

Debug log

yf.download('SPY', start="2020-08-28", end="2020-08-31")
DEBUG    Entering download()
DEBUG     Disabling multithreading because DEBUG logging enabled
DEBUG     Entering history()
DEBUG      Entering history()
DEBUG       SPY: Yahoo GET parameters: {'period1': '2020-08-28 00:00:00-04:00', 'period2': '2020-08-31 00:00:00-04:00', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG       Entering get()
DEBUG        url=https://query2.finance.yahoo.com/v8/finance/chart/SPY
DEBUG        params=frozendict.frozendict({'period1': 1598587200, 'period2': 1598846400, 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'})
DEBUG        Entering _get_cookie_and_crumb()
DEBUG         cookie_mode = 'basic'
DEBUG         Entering _get_cookie_and_crumb_basic()
DEBUG          loaded persistent cookie
DEBUG          reusing cookie
DEBUG          crumb = 'Me.50YI13rf'
DEBUG         Exiting _get_cookie_and_crumb_basic()
DEBUG        Exiting _get_cookie_and_crumb()
DEBUG        response code=200
DEBUG       Exiting get()
DEBUG       SPY: yfinance received OHLC data: 2020-08-28 13:30:00 -> 2020-08-28 13:30:00
DEBUG       SPY: OHLC after cleaning: 2020-08-28 09:30:00-04:00 -> 2020-08-28 09:30:00-04:00
DEBUG       SPY: OHLC after combining events: 2020-08-28 00:00:00-04:00 -> 2020-08-28 00:00:00-04:00
DEBUG       SPY: yfinance returning OHLC: 2020-08-28 00:00:00-04:00 -> 2020-08-28 00:00:00-04:00
DEBUG      Exiting history()
DEBUG     Exiting history()
DEBUG    Exiting download()
yf.download('SPY', start="2020-08-28", end="2020-09-01")
DEBUG    Entering download()
DEBUG     Disabling multithreading because DEBUG logging enabled
DEBUG     Entering history()
DEBUG      Entering history()
DEBUG       SPY: Yahoo GET parameters: {'period1': '2020-08-28 00:00:00-04:00', 'period2': '2020-09-01 00:00:00-04:00', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG       Entering get()
DEBUG        url=https://query2.finance.yahoo.com/v8/finance/chart/SPY
DEBUG        params=frozendict.frozendict({'period1': 1598587200, 'period2': 1598932800, 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'})
DEBUG        Entering _get_cookie_and_crumb()
DEBUG         cookie_mode = 'basic'
DEBUG         Entering _get_cookie_and_crumb_basic()
DEBUG          reusing cookie
DEBUG          reusing crumb
DEBUG         Exiting _get_cookie_and_crumb_basic()
DEBUG        Exiting _get_cookie_and_crumb()
DEBUG        response code=200
DEBUG       Exiting get()
DEBUG       SPY: yfinance received OHLC data: 2020-08-28 13:30:00 -> 2020-08-31 13:30:00
DEBUG       SPY: OHLC after cleaning: 2020-08-28 09:30:00-04:00 -> 2020-08-31 09:30:00-04:00
DEBUG       SPY: OHLC after combining events: 2020-08-28 00:00:00-04:00 -> 2020-08-31 00:00:00-04:00
DEBUG       SPY: yfinance returning OHLC: 2020-08-28 00:00:00-04:00 -> 2020-08-31 00:00:00-04:00
DEBUG      Exiting history()
DEBUG     Exiting history()
DEBUG    Exiting download()

Bad data proof

No response

yfinance version

0.2.37

Python version

3.9.10

Operating system

macOS 14.1.2

@ValueRaider
Copy link
Collaborator

ValueRaider commented Apr 12, 2024

Read the debug log. yfinance forwarded your request to Yahoo

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

No branches or pull requests

2 participants